Setting up publicly-accessible DNS name in Google Cloud DNS

Solution 1:

Just posting this answer for anyone having this same issue and in case the stackoverflow answer gets deleted.

The way you had it configured would not work as this name (myapp.uswest.cloudapp.google.com.) will not be recursively resolve. For the very reason that it doesn't create any record under "google.com." for "uswest.cloudapp.google.com" zone.

GCP has internal FQDN for Compute Engine VMs for communicating between instances in the same VPC network, that can be used to send packets to an instance by specifying the fully-qualified DNS name (FQDN) of the target instance. The VPC network automatically resolves the name to the internal IP address of the instance. However, it is not possible to use it externally.

For external communication, you would have to have your own domain (you could register one if you don't have one already) and create an A record that would resolve against the external IP of your VM. However, in this case, you could use Cloud DNS to create a zone for your registered domain.

Solution 2:

...and create an A record that would resolve against the external IP of your VM

That's not great because the free "ephemeral" address could change in the future.

Microsoft does it better - for your dynamic VM IP address in Azure you can have a free permanent DNS name (something like myapp567.azurewebsites.net) and then just create a CNAME pointing to your own domain (like myapp.mydomain.com).