Creating VM/Compute Engine instance on GCP

leangaurav
4 min readDec 12, 2019

GCP is Google Cloud Platform; an offering from Google. It’s like AWS (Amazon Web Services) if you know of AWS. Why we are using GCP? It’s just that I picked it first and doesn’t require billing enabled in the beginning unlike AWS. Though AWS also offers free things.

Now login to your google account then go to GCP page or directly go to below link and login there if not already logged in.

GCP offers free trial credit of $300 for an year when you enable it for the first time. You will not be charged for anything for one year if your total billing is less than the free trial credit. For our setup it will be less then the free credit for entire year. Remember to upgrade your account before your free trial ends if you wish to continue with your website(you will need to enable billing for your account). Otherwise once your trial ends your VMs will be gone.

Once you sign-in, click on Get started for free.

Your GCP home page will look something like this with a hamburger icon on top left(You most likely will not see any graphs if you are using it for first time).

Click that hamburger icon and scroll down to Compute section. Click on Compute Engine and then select VM instances. Remember these steps as we will need to come back to this page which lists Compute Instances multiple times later.

Hamburger → Compute → Compute Engine → VM Instaces

On instances page you will find a button to Create Instance. In my case there is already one instance showing up in the list.

A new page will open up to configure settings for creating a new Compute Instance. While configuring, it will also show you the monthly cost estimate on the right. If you want to further bring down the cost, you can change to inferior configuration settings.

Anyways for us we will change only a few things.

First half can be left as-it-is. In the second half we need to change the Boot disk to Ubuntu 18 LTS and also tick the check boxes for Allow HTTP and HTTPS traffic.

Without Http and Https traffic enabled, we will not be able to access our website from outside world.

This done, click on create and wait for some time for instance to get created and startup. You will see a green icon next to the instance. Once that happens, remember the IP Address written over there for your new instance and then click on hamburger icon again. Now scroll down to Networking section, then under VPC Network click on Extenal IP Addresses.

Hamburger Networking → VPC Network → Extenal IP addresses

Networks page contains info of the networks associated to each of your instances and you will find one for your newly created instance as well. What we need to do here is change the value ephemeral to static.

Why? Because ephemeral means that the ip would change each time VM is restarted. Which is what we don’t want. Static IP means it won’t change till the time you don’t delete the instance itself or you change the settings again.

You need to click the drop-down arrow and then it will ask you to give a name and description. Just do that and it will change to static as in below image. Copy the IP Address value under External Address somewhere or you can come back again to see the IP. We will need it in the next steps.

That’s it for this section. You can head over to next one Cloudflare and Domain Setup for your Website.

Please comment your views or any help you need 😄

--

--

leangaurav

Engineer | Trainer | writes about Practical Software Engineering | Find me on linkedin.com/in/leangaurav | Discuss anything topmate.io/leangaurav