4

Azure provides a way to access a VM using *.cloudapp.net, is there something similar in GCP? If yes, where/how can I see the exact CNAME for accessing the instnace?

I read it that its *.googleapi.com, but not able to find it anywhere on GCP portal

Note this SO question comments says it should be of format computername.c.googleprojectid.googleapis.com, is that not correct?

harishr
  • 17,807
  • 9
  • 78
  • 125

2 Answers2

2

Google Cloud Compute Engine virtual machines (instances) are accessed by IP address outside Google Cloud or by internal DNS name inside Google Cloud. If you want a public DNS name, you must configure the public DNS name in your DNS server for your domain name.

Google Cloud does create an internal DNS name for your instance. However, this DNS name is private and only resolves in the same VPC as the instance.

John Hanley
  • 74,467
  • 6
  • 95
  • 159
  • But then how do I point CNAME to a google cloud hosted website? – harishr Oct 21 '19 at 08:16
  • First, assign a Regional IP address to the instance. Then point the root (example.com) you using an A record. The subdomains (www.example.com) can use A or CNAME records. You cannot use CNAME records for the root domain (example.com). – John Hanley Oct 21 '19 at 13:28
  • Thats interesting.. I can assign A record to subdomain, that should solve the problem – harishr Oct 21 '19 at 13:39
  • Typically, but not always you assign the A record to the root (example.com) and the subdomains using a CNAME that point to the root (www.example.com -> example.com). That way when you change the A record, you don't have to change the CNAME records. – John Hanley Oct 21 '19 at 13:52
1

You could use Cloud DNS, while setting the name-servers at the registrar to Cloud DNS. See Updating your domain's name servers. This means, you'd have to provide your own domain-name and at least one external IP - even with external DNS. The location of the zone-file to edit merely depends upon which name-servers the domain registration has set.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
  • But then how do I point from CNAME from external DNS to a google cloud hosted website? – harishr Oct 21 '19 at 08:17
  • @harishr you need an `A` record, which is the external IP address. for that you can set `CNAME`. there aren't any such generic host-names, unless you set them up (only Firebase has similar host-names). No external IP address - no external DNS records. With Cloud DNS, you could manage the records in the GCP console - but with external DNS, you have to manage them at whatever registrar. – Martin Zeitler Oct 21 '19 at 10:23