How to create a Virtual Machine (VM) on Google Cloud Platform (GCP)

Google Compute Engine lets you use virtual machines that run on Google's infrastructure inside the Google Cloud Platform. You can create small VMs or larger instances with Debian, Windows or other standard images as per your requirement on the Google Cloud Platform(GCP). 

The user can rent a VM and pay as per the usage. To understand more about billing, click here 

In this article, we will demonstrate how to create a virtual machine (vm) using the Ubuntu 18.04 boot disk image in Google Cloud Platform (GCP), but first, let us have a look at what is a virtual machine.

What is a virtual machine?

A virtual machine is a computer file called as an image that runs on the hypervisor making it feel like a full-fledged machine, it behaves like an actual computer, the processes within the virtual machine are isolated from the host system, this makes it ideal for cloud computing. Cloud providers like GCP provision multiple virtual machines on a single hypervisor that share the same underlying hardware.

Below is a basic architecture diagram of a virtual machine.

Virtual machine Architecture


This article assumes the user has a valid Google Cloud Platform account. If the user does not have the GCP account they can create one by clicking on the link provided below.

Create GCP Account

What we will do:

  1. Login to Google Cloud Platform
  2. Create a virtual machine from Ubuntu:18.04 Boot Image
  3. Connect to the Instance

Login to Google Cloud Platform

  1. Click here to go to the GCP login page.

When you hit the above link, you will see a web page as follows where you are required to login using your credentials.

Google Login

Create a virtual machine from Ubuntu:18.04 Boot Image

Step1: Navigate to the Compute Engine Section from the side navigation pane and click on VM Instances.

Create Virtual machine

Step 2: Click on the ‘CREATE INSTANCE’ button in the top navigation pane.

Create Instance

Step 3: Select the options

  • Name: Type in the name of the virtual machine. Please note that the Name must be lowercase letters, numbers, and hyphens
  • Region and zone: Select the region and zone where you wish to launch the VM instance. As per GCP official documentation A region is a specific geographical location where you can host your resources. Each region has one or more zones”
  • Machine configuration: Select the machine configuration as per your requirements, you can find more information on Machine configuration herePlease note for the purpose of this article I have kept the machine configuration to default, those can be seen in the image below

Virtual Machine Options

Boot Disk: Select the boot disk as per your preferences, here I have selected the ubuntu 18.04 boot disk.

Choose Boot Disk

Step 4: Click on the create button at the bottom of page, This will start the process of creating a VM in GCP, it may take a while for the VM to be up and running.

A green tick will appear next to the VM name once, the VM instance is in available state 

VM Instance available

Connect to the Instance

Navigate to the recently created VM instance and click on SSH menu and select the "Open in browser window" option

Connect to VM Instance

Please note that it will open the shell in a new tab you can now access the VM instance using the browser.

Shell access to Google VM


This article demonstrates the creation of Ubuntu 18.04 VM instance with the default setting, GCP provides advance options for us to configure the Instance type, Disk type, and the network preferences as per our requirements, however, they are out of scope for this article, you can play around with the VM instance advance options in GCP if you wish to do so.

Share this page:

Suggested articles

4 Comment(s)

Add comment


By: Rupesh Shinde

Good information. I have created VM on GCP by following this tutorial and did not faced any problem!

Thanks Ajinkya

By: Pablo

Hi. I'm having issues with GCP. I created virtual machine with program always free that allows you to have a virtual machine with a cpu f1 600Mhz processor, 600MB RAM and 30GB of disk space if you create it in some regions, I created in oregon and checked with Google Cloud Calculator for possible charges but there weren't. Recently I checked disk space in my virtual machine and I hadn't 30Gb of disk space as it was asigned in boot disk, /root only had around 9GB and it was at 95% of usage, is it because I chose a Google Cloud Platform image? Should I have chosen a operative system iso to install it and customize it in the installation? I like the Google Cloud Platform image because it comes with Security Enhanced enabled and doesn't seem to conflict with any package installation although I had a issue with mysql boot and disabled and enabled se and ssh stopped working. I have contacted with free trial google cloud support but I'm not very sure they are going to help me because my product is always free which is different. Where I was working time ago there was a pxe and kickstarter where you could choose image and set partitions sizes, I don't understand why google doens't allow to do the same unless I have done something wrong.

Thanks anyway for your help.

By: Pablo

Finally it seems storage missing is deployed, I checked it after GCP support replied me to run fdisk -l, so I think I will be able to assign left GB probably not assigned during image deployment.

Regards and thanks for the tutorial

By: Ramya erla

Very helpful