How I added a custom domain name to my Google Compute Engine VM

Damilare D. Adekunle
4 min readMay 26, 2020

--

Credit: Freepik

You possibly don’t want to deploy a fully functional website or web app on Google compute engine and have users access your site via an IP address.

So, I’m going to be taking you through a step by step guide on how to assign a custom domain to your compute engine VM by showing you how I did mine!

I hosted my personal website on Google Cloud using the Marketplace for a WordPress deployment on a compute Engine VM. The process is an easy one and you end up with a WordPress site on a VM with your choice of specs. If you check the VM instance section of Compute Engine menu, you will see your VM already deployed with an internal and external IP assigned.

Want to read this story later? Save it in Journal.

For this guide, what is important is the external IP, so in the case where you’re not deploying a WordPress site, just make sure whatever is on your VM is accessible by the assigned external IP.

Because Google domains is currently unavailable in my country, I had to use Porkbun, an independent domain name registrar to register my domain name. It’s also a simple process.

  1. Search for your domain name

2. If available, add to cart and checkout. If not, change your domain name and search again.

Now that we have our IP address and our domain name, let dive deep into connecting our new domain name (www.anything-you-chose.com) on Porkbun or any other registrar to our Google Compute Engine VM.

From your domain name registrar, find where to edit the nameservers and use the Google nameservers.

ns-cloud-b1.googledomains.com
ns-cloud-b2.googledomains.com
ns-cloud-b3.googledomains.com
ns-cloud-b4.googledomains.com

Porkbun nameserver editing

Depending on who your registrar is, you might be alerted that the step you are taking will affect your website, but just go ahead anyway. Your website is safe and in safe hands, your hand!

Moving on to Google Cloud console, navigate to Cloud DNS and create a new zone. You can find cloud DNS in the Network Services of the Google Cloud menu, or you can search directly for it in the search field.

Create Zone

Add a zone name to identify the zone you are creating for your website. You can create as many zones for as many different websites as you want.

For DNS name, put your registered domain name there. Please ensure that there is no prefix in that field. Just your domain name is needed there e.g mywebsite.com not www.mywebsite.com. Leave the DNSSEC as off, and add a description to your zone if you like. Click create and let the magic happen.

Upon successful creation, the DNS service automatically adds two default record to you new zone, the NS (Name Server) and SOA (Start of Authority) records.

What is left is for you to create a new record, and add the IP address of your VM. To do this click any of the two “ADD RECORD SET” button on the page.

For the first record, leave everything as default but add your IP address to the IP address field and click create.

After this, create another record and repeat the same step, except that this time, add a “www” prefix to the DNS Name field. Click create.

It takes some time for your new changes to reflect, ususally the specified time in the TTL (time-to-live).

What else? Enjoy your new useful domain name, clap for me, drop a comment, and visit the website (damilareadekunle.com) I achieved this on! Don’t forget to follow me on Twitter (ddadekunle) Cheers!

📝 Save this story in Journal.

👩‍💻 Wake up every Sunday morning to the week’s most noteworthy stories in Tech waiting in your inbox. Read the Noteworthy in Tech newsletter.

--

--

Damilare D. Adekunle

I design for humans! Product Designer at Data Friendly Space (DFS).