Search code examples
google-cloud-platformcnamegoogledns

redirecting a subdomain to google cloud


I have domain under which there are multiple subdomains pointing to different websites hosted on azure. I am starting to explore google cloud and want to host a subdomain on google cloud.

Below is how DNS record should look like

A - GO Daddy hosted main website IP address

CNAME - subdomain.example.com - subdomain.cloudapp.net
CNAME - subdomain2.exapmple.com - subdomain2.cloudapp.net

now I want to add a cname for another subdomain to be hosted on google cloud

CNAME - subdomain3.example.com ??.googleapi.com

I have public IP address from GCP, but how do I get subdomain for GCP to be used for CNAME record? As per answers to my another question GCP does not provide public CNAME for VM instances. So what should I provided in CNAME record. (I do not want to move the DNS to google, or to azure for that matter)


Solution

  • Based on your question and the reference to Google not providing names for VM instances, I am assuming that you are trying to create a DNS record for the external address of a VM instance.

    If you have a static IP address, you should just configure your DNS provider to use an A record for that IP address, rather than a CNAME.

    CNAME records just create aliases for the target names, where A records can point directly to the correct IP.

    Note that if the IP on your instance is ephemeral rather than static, then you would need to keep updating the DNS record whenever you restart the instance (and get a new IP), so it would be highly recommended to use a static IP for the instance in this case.