Adding Custom Domain To Google Compute Engine Project

Follow these steps to add a custom domain name to your Google Compute Engine project. I assumed that you already have a project successfully serving on Compute Engine, and have enabled billing to your account.

Select “Cloud DNS” under the “Networking” section in the left navigation bar, as shown in following screenshot. If you are doing it for the first time, it may take few minutes for activating the service.

google-cloud-dns

Once Cloud DNS is active for your project, you would find a “Create Zone” button on its page. Click on it, and provide your details as suggested, and hit the Create button.

dns-zone-google-cloud-computing engine

This should create a new zone record for your project, and redirect you to the detailed information page, where you can find resource record sets (NS records and SOA record).

google-compute-engine-custom-domain

Next step would be updating NS records of your domain name at your domain registrar. After updating NS records with your domain registrar, you have to add one A record and one CNAME record at Google Cloud DNS. You can create these record sets by clicking on the “Add Record Set” button on the top.

Add an A record with the IPV4 address of your VM in use. You can find this IP address by navigating to Compute > Compute Engine >VM instances.

google-cloud-dns-a-record

Similarly, add a CNAME record with value ‘www’ and pointing to your naked domain name (xyz.com).

google-cloud-dns-cname-record

Once you complete above four steps (creating new zone, updating NS records with your domain name registry, creating A record and creating CNAME record), you are done! Your domain name should start serving your compute engine project.

Note that there may be some delay due to DNS propagation, so wait for it, or use Google Public DNS resolution service on your machine. Moreover, you can add other zone record types (MX, TXT etc.) in the same way by clicking on that “Add Record Set” button.

Related: Install WordPress on Google Compute Engine

arpit

Posted by Arpit

Arpit is a web enthusiast watching browsers for long. He maintains several browser-based tools including many popular extensions. Follow Arpit on Twitter, or email him at editor@browsernative.com.
Post last updated on February 26, 2015.

You may also like ...

4 Responses

  1. Irfan says:

    H there,
    I have already done. its redirecting my domain “www.mydomain.com” to my instance’s ip address. in browser’s address bar its showing only IP address instead of domain name. how to solve this.

  2. Animesh says:

    Thanks for the step by step instructions. I cannot believe how shitty this particular official Google Compute Engine Documentation is! (Regarding Domain & IP config.) Completely crap and unnecessary rubbish garbled up together into horse-shit! Google needs to learn to do it the way you did!
    Thanks again!

  3. David Del Valle says:

    You dear saved my life today. Thanks.

  4. Yogesh Doke says:

    internal or external which ip address and what about 8080 port ,my app is running on 80 port

Leave a Reply

Your email address will not be published. Required fields are marked *