Open In App

How To Use Compute Engine To Launch And Manage Virtual Machines ?

Last Updated : 05 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Google Compute Engine (GCE) is one of the cloud services offered by Google Cloud Platform (GCP). GCE provides Infrastructure as a service (IaaS) which allows users to create and manage Virtual Machines on Google’s infrastructure. Users can launch their custom OS images using a VM. GCE follows a pay-per-use model which allows users to pay only for the usage.

What Is A Virtual Machine?

A Virtual Machine is a computer operating system that can be operated from the cloud. With the help of a Virtual Machine, a user can deploy various applications on the cloud, host a website, create and manage APIs as well as Microservices and many more cloud services.

In this article, I will walk you through a step-by-step guide on how to use a computing engine to Launch and Manage Virtual Machines.

Steps To Launch Virtual Machines

Step 1: Goto GCP Cloud Console

Step 2: Create a project

If you haven’t created a GCP account or a project in GCP, you can refer to this article.

Step 3: Navigate to Compute Engine -> VM Instances

  • To do this, you can click the menu option in the top left and navigate to VM Instances as shown in the below image.

VM Instance

Step 4: Enable Compute Engine API if not done already

  • To enable the API, the GCP asks for a billing account. Make sure to set up the billing account.

Step 5: Create a new instance

  • The instance is the Virtual Machine instance that we need to launch.
  • Click on the CREATE INSTANCE button on the top right and fill in all the required parameters for your project.
  • The parameters include the name of your instance, the preferred region and zone of the instance, CPU and memory type, preferred OS, size of disk etc.

Create a instance

  • After filling in the parameters, click on the CREATE button. It will take a few minutes to create your VM instance.

Step 6: Connect to the VM instance

  • Once the instance is created, you can view it on the VM instances page. Click on the SSH button to connect to your machine through the command line.

Connecting VM with ssh

Step 7: (Optional) Connect to VM instance from local computer.

  • You can also connect to a VM instance from your local computer. Open the terminal and enter the below ssh command.
ssh YOUR_USERNAME@VM_EXTERNAL_IP

You can get the username and VM_EXTERNAL_IP from the GCP console.

Steps To Manage Your Virtual Machines

Step 1: Start, Stop or Resize the VM instance

  • Navigate to Compute Engine -> VM Instances. Here, you can see the list of VM instances. You can stop, restart, resize or delete a VM instance.

start/Stop the VM Instances

Step 2: Create a custom image or snapshot.

  • You can create a custom image or snapshot of your VM instance.
  • An image contains all the data of the VM machine while a snapshot captures the data at a specific point in time.
  • This can be used for backup and restore purposes.
  • To create an image/snapshot, navigate to Compute Engine -> images/snapshots as shown below.

Creating Images/Snapshot

Step 3: Creating health checks

Navigate to Compute Engine -> Health Checks same as above. Health checks are used to check whether applications in VMs respond to requests. You can create health checks for the applications in your VM instance.

Congratulations, you have successfully launched and managed a VM instance using GCE. In this way, you can easily launch and manage VM instances using the Compute Engine option. Do explore and experiment with various options provided by GCE.

Usage And Management Of Virtual Machine – FAQs

What Is A Compute Engine?

Compute Engine is a computation service provided by GCP to create and run your own Virtual Machines.

What Is A Virtual Machine?

A Virtual Machine is a computer Operating System that can be operated from the cloud.

Do We Need a Billing Account To Create A VM?

Yes. You need to enable billing to create a VM in GCP.

What Is The Cost Of Launching A VM?

It depends on the specific use case of your VM. To know more, you can visit VM instance pricing page.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads