Andrew Maxwell

How to add a custom subdomain using Google Cloud DNS

July 15, 2014

Google Cloud DNS is only available via command line or RESTful API’s so it may seem pretty intimidating when you first look at it, but after learning a couple commands in your favorite terminal client, you’ll get the hang of it.

Step 1:
Ensure that Google Cloud SDK is installed.

Step 2:
Create a new zone. A zone is typically the name of the top level domain.
gcloud dns managed-zone create --dns_name="example.com." --description="A test zone for example.com"
Note: The “.” at the end is important to have as part of the name.

Step 3:
Update the name server records in your domain name host with the 4 values that are returned in “rrdatas” after running step 2 above. This should look something like “ns-cloud-e#-googledomains.com.”. When you enter in the name server value into your domain name host, you may have to leave off the suffixed “.” in order to save the value.

Step 4:
Create a new record:
gcloud dns records --zone="example.com" edit
Insert the following value within the “additions” array.

{
"kind": "dns#resourceRecordSet",
"name": "subdomain.example.com.",
"rrdatas": [
"123.124.421.321"
],
"ttl": 300,
"type": "A"
}

Notes:

  • Ensure that the IP address that you are using in “rrdatas” above in step 4 is available on your machine and that your domain name servers are updated and point to the Google Cloud name servers that you received, after creating your new zone above in step 2.

Leave a Reply

You must be logged in to post a comment.