google-cloud-platformdnsgoogle-cloud-rungoogle-cloud-dns

How to allow for cross-project domain mapping in Cloud Run?


I'd like to manage my application as follows:

So for example, let's say I manage mydomain zone in Project A, with www.mydomain.com, app.mydomain.com and staging.mydomain.com CNAME records configured there.

In Project B I manage one Cloud Run service, staging-service.

In Project C I manage two Cloud Run services, www-service and app-service.

How can I map the services from Project B or C to the domains/subdomains in Project A?

Thanks for the help!


Solution

  • DNS does not care which projects your resources are in. You can create DNS resource records for supported resources located in any project. DNS is a hostname to IP address translation service.

    When mapping custom domains in Cloud Run, you will be presented with DNS resource records to create. Those records are IP/CNAME based.

    Mapping custom domains

    Your will first need to verify site (domain) ownership for each project that you wish to use custom domains or certificates:

    Verify your site ownership

    Cloud Run: Add verified domain owners to other users or service accounts