Algobook
- The developer's handbook
mode-switch
back-button
Buy Me A Coffee
Sun Mar 19 2023

How to do Custom Domain mapping in Cloud Run

So, you have deployed your application to Cloud Run and everything is working out nicely. But now you want to get rid of that default URL that Cloud Run are providing you with and replace it with your nice domain name? If the answer to that question is yes, or if you just want to know how to map your domain to a Cloud Run service, don't look further!

Prerequisites

  • A Cloud Run service up and running
  • A domain name and a DNS provider (like GoDaddy or similar)

Set up the domain

In this section, we will demonstrate how the set up is done in GCP

Go in to GCP and enter your Cloud Run service and click on the MANAGE CUSTOM DOMAINS button

Cloud Run page

Click on the ADD MAPPING button

Add mapping page

Select the service you want to do the mapping to and enter the domain name that you own

Verify domain

Verify the domain. NOTE: You can verify it on the webmaster central and choose the vendor you purchased the domain from, and authenticate from there.

verify domain

When the domain is verified. It is time to update the DNS records at your provider. You will get the DNS records presented in a pop-up. Copy the values into the DNS settings at your providers website.

DNS records

Google will start to verify that the records are set up correctly. And now, we will set up a new mapping for a subdomain for www.yourdomain.com.
Click on ADD MAPPING again and select your verified domain and then type in the domain with www. as prefix.

sub domain

And at last, the CNAME should be updated at the providers website as well.

CNAME mapping

That's it!

Now everything is done. NOTE: It can take several hours for the DNS to be properly propagated and be fully functional, so if it doesn't work for you immediately, don't worry.

I hope this guide will help you set up your domain to point to your Cloud Run service. See you in the next one!

signatureSun Mar 19 2023
See all our articles