So you want to start using Google Cloud (part 2)

Mack Davenport
6 min readMar 13, 2019

--

If you followed the steps from the previous blog post, now you’ve got a live website hosted by Google Cloud, accessible to the world.

https://<yourprojectname>.appspot.com/

If you’re like me, the appspot is a little embarrassing to leave around and put on a business card, resume, or ask someone to check out. It’s an unfinished job.

You’re better than that.

In this walk through, I’m going to show you how to get your website on your own domain.

https://domains.google.com/

To get started, you’ll need a few things.

  1. A GCP account
  2. A domain — I’m going to be using a Google Domain
  3. A currently accessible project, that runs — or not, but it helps

If you choose to use another domain, the verification of ownership varies for each domain host. I’ll discuss later, but it usually involves including a CNAME with a unique ID they provide to your chosen domain’s DNS settings.

If you don’t currently have an accessible project, please refer to my previous post on how to get started with one.

DNS

For this walk through, go ahead and head over to Google Domains. If you currently have a domain, go into the dashboard for the one you want to use. Once there, head into the DNS settings.

DNSSEC

Enable DNSSEC. This will prevent any problems you might encounter as new websites can be targets of DNS spoofing. It’s free and provided by Google, so you may as well turn it on until you need an alternative.

Custom resource records

For our purposes in this example, the most important part is Custom Resource Records. In just a moment, I’ll explain how to populate this area and where to get the values from.

App Engine settings

Head over to your console, select your project, go to App Engine and into App Engine settings.

Custom domains

Select the tab for Custom Domains and then click the button Add a custom domain. If you’ve not already purchased a domain, you can use the button available here to register a new one.

In the prompt, enter your domain and click verify. This will immediately take you to the verification process.

As you can see, I’ve entered my domain that I’ll be using. I’ve selected Google Domains from the drop down box.

If you’re using a custom domain, this is where the process deviates. Please follow the instructions provided to you by Google to verify ownership of the domain.

Google asks me to add a TXT record to the DNS configuration. I’m not going to do that here, instead I’m going to click Add a CNAME record here. Adding a CNAME is the more prevalent method that is more often successful in my experience. But you can do either.

Back over in domains, you’re going to go into your custom resource records. Here I’m going to add the CNAME provided to me.

If you were going to use the TXT record, simply place the data in the right-hand column. Leave an @ in the name column.

If you want to see near instantaneous changes, change your TTL to 60 or 1m. This means these DNS changes will be live really soon. I don’t recommend leaving it at 1 minute, but for now, it’s fine.

TTL just means time till live and, while a very important concept to understand if you’re working with a live site, is less relevant during this example. Feel free to read up here. But for now, just leave it.

Once your changes have been successfully applied, you should be able to click the Verify button. If you’ve done everything correctly you should see this screen!

If you don’t get this screen, feel free to drop a message in the comments and I’d be happy to help. But most likely your DNS changes have not taken effect yet or sometimes the trailing . isn’t accepted by other domain hosts.

After we’ve successfully verified our DNS, we can go back over to our project console where we left off. You refresh and you should also get this successful message. Go ahead and continue.

If you’re interested in adding subdomains and vanity tags, this is the place to do it. In this case, I’ve decided to add a dev.prefix to my domain. Save those mappings. It may take a few moments, but as soon as they’re automatically configured, you can click continue.

Some data hidden

Here’s the important piece. This data is how you tell your domain host to route users to the project you’re hosting on Google.

Head back over to your domain’s CSR section. Leave the @ in the name field, select the A type resource. Again, chance the TTL if you’re interested.

Take the corresponding values provided to you and place them into the data field. You can easily add multiple with Google’s form.

Repeat this process for the AAAA type resource values.

If you’re working with another domain, you can follow this same principle. Just manually type @ in as the name and fill the in the corresponding values.

For each CNAME record, which would include any additional subdomains you requested earlier, or just www if not, enter it in as shown above.

Once you’ve entered all of these values, go ahead and click done. This will take you back to the custom domains settings overview.

The first CNAME available for me to access was the dev subdomain, which was almost instant.

If you’ve followed everything successfully to this point, congratulations! You’re hosting a website you can be proud of!

Don’t fret if you can’t access www.yourproject.com. As soon as the loading icons are no longer there (usually within an hour), you can access your other domains!

Depending on your provider, DNS settings can take a while to update. Some have minimum TTLs much higher than 1m, so this process may take some time. I recommend Google domains if you’re going to work with GCP. They’re pretty cheap and integrate with ease together, sometimes automatically.

--

--