Cloud Resume Challenge Step 6 – DNS

This step requires me to point a domain name to the load balancer endpoint that we created in the last step.

The Domain Name Service (DNS) is the phonebook of the internet. It allows for person-friendly domain names to be translated, and traffic routed towards, the actual name of an online resource: its IP address.

As I registered my domain name with Google Domains, I’ll have to set my name servers on that platform to point to GCP but first I need to tell GCP where to send the resulting traffic. I can do this with Cloud DNS.

Cloud DNS uses “zones” to host the rules specified for routing traffic to its ultimate destination. Here I need to create a new zone, name it, and specific the domain name that I’m using:

From my newly created zone, we now just need to add a couple of record sets. Firstly, I need to point my domain to my load balancer frontend using the “A” record type (which is simply the type used to map a hostname to an IP address):

I then need to account for the possibility that someone might use www.chrisjohnson.tech to access the resume. As “www.” is technically a subdomain (albeit an extremely common one!), the traffic won’t go anywhere unless I tell it where to go. For this I can use a CNAME (or canonical name) record to point from the www subdomain to the actual domain of my site:

Super simple! Quick note that I’m also hosting this blog at the subdomain blog.chrisjohnson.tech. As the blog already exists, and has its own SSL certificate for HTTPS, it was a simple matter of creating another “A” record for the subdomain and pointing it to the blog’s own IP address.

As a final step, I just need to grab our nameservers from the “Registrar Setup” link at the top-right of the Zone Details, page and then hop over to Google Domains to add these in the Custom Name Servers section:

All sorted! Following a short wait for the domain settings to propagate across the internet, and our SSL certificate to finish provisioning, I’ll have a static site live, with a dedicated domain name using HTTPS for security. Now to change tack entirely and start working on the page counter, starting with selecting a database…