public instance CNAME for GCP compute instance - google-cloud-platform

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?

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.

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.

Related

How can I access the internal DNS name of a GCE instance?

I want to access a Google Compute Engine instance by a permanent name. I found that there is supposed to be an internal DNS name for this like:
updateservice.us-central1-a.c.myproject.internal
however If I try to ping this instance from cloud shell I only receive:
ping: updateservice.us-central1-a.c.myproject.internal: Name or service not known
why is this? and how can I access updateservice via DNS name?
We cannot use Cloud Shell to access or ping internal DNS name for the reason that it is on a separate network. You can check this by running this command “ip -4 addr”.
Internal DNS can only resolved from VMs that are in the same network. You can check this link for more information.
For further understanding on how Private DNS works you can also follow this link on how to create Private DNS.
UPDATE
2022 - 12 - 07
It will depend on you on how you will access your domain name.
First if you are going to access it via internal connection that is the time that you need to use Private DNS. The connection will be from one VM instance to another in the same VPC network.
Using Cloud DNS and configuring Private DNS it will give you the option to have your own domain name. You can watch this link on how you can create a Private DNS and understand the internal connection between VM instances.
But based from this link there is already an internal DNS created for your vm instance but please dont be confused, the concept is the same with Private DNS. The only difference is Internal DNS is already created once a VM instance is created but it has a default domain name.
Unlike Private DNS configured under Cloud DNS, you have the option to have your own domain name. If you are using a linux server you can run this command “hostname -A” to get the default domain name of your VM instance.
What I discuss above is for internal access. Now the other way is external access, meaning you will access your VM instance outside your network. This will enter Public DNS. Before you create Public DNS you will need a domain name from a domain provider.
Once you already have a domain name from a domain provider, you can create Cloud DNS then configure Public DNS. Once it is created you need to add “A Record”. This is just one step from your GCP network in order to have access using your domain name from external access.

Issue routing custom domain to GCP's VM Instance

When I type in my custom domain, http://jakeyoon.dev , I get ERR_CONNECTION_TIMD_OUT.
I purchased the domain from Google Domain and set up a simple LAMP stack using GCP Marketplace and VM Instances.
I added A record from Google Domain's DNS Settings that points to VM Instance's external IP address.
I also added a CNAME to route www.jakeyoon.dev to jakeyoon.dev
I didn't change any name server
VM's external IP works when just routing directly.
http://34.134.167.124/
I get the correct IP address when I do a DNS resolve
https://dns.google/query?name=jakeyoon.dev
I would appreciate any advice!
Do I need to host a zone and use Cloud DNS from GCP?
What else do I need to change from Google Domains?
Thanks

Google Cloud domain name for instance (like EC2)

On creating an EC2 instance on AWS, you can access it via IP address or a domain name provided by Amazon out of the box:
Is there a similar thing available for Google Cloud out of the box? I'm on a network that blocks IP addresses, and wildcard DNS like xip.io, so I was curious to know about it. Also, is there a specific term this is called which I'm missing?
When you create a GCP Compute Engine instance (EC2 equivalent) you can declare that you want it to have a public IP address. This is an IP that you can use over the Internet to access your instance. GCP gives you two types of IP ... static (stable) or ephemeral. A static IP is yours until you explicitly release it. There is no charge for this as long as your compute engine is running. An ephemeral IP is one which is allocated to you dynamically and may change following a restart of your compute engine instance.
GCP does not (currently ... things could always change) create a DNS entry that will resolve to your IP address over the Internet. It does create a DNS entry that can be used inside your GCP VPC network to allow one compute engine to call another within the GCP environment.
If you want to reach your Compute Engine via a DNS name it is your responsibility to create a DNS "A" record in your own DNS server. If you don't have a DNS server that you can use, then you can obtain a domain name for a few dollars and then create an instance of a GCP Cloud DNS Server and add an "A" record for your compute engine to that server.
See also:
Cloud DNS
Internal DNS
Yes, you can forumate internal dns for instance using [INSTANCE_NAME].[ZONE].c.[PROJECT_ID].internal
See the following link for further information: https://cloud.google.com/compute/docs/internal-dns
Please ensure the ports are open.
You can visit the documentation as below for your reference, hope this helps.
https://cloud.google.com/vpc/docs/firewalls

GKE - Private Cloud DNS addresses, how to access endpoints from office

I have the following setup:
GKE - Running many pods, annotated with External DNS endpoints.
External DNS running, creating DNS addresses in Cloud DNS.
Cloud DNS managed zone, with addresses automatically upserted from GKE.
I don't want to expose these dns addresses to the internet, as this is a testing cluster, but i'd like to open it to, set's say, my offices ip, address.
I'm not sure how/where to even start with this in GCP, I'm sure there's a product name for this that I'm just missing. :/
Cheers,
Ben

VM instances does not use the google cloud dns forwarder to resolve

i have setup my infra on GCP and created a VPC and firewall rules to allow outgoing 53 from inside my network to the outside.
i also setup a private dns zone in google cloud and added a dns forwarder ip (e.g. 192.168.1.1) to it. i also added the network that my vm is in to the dns zone allowed list .
now when i launch my VM and try to dig to test.mydomain.com it does not work, but when i put the ip mentioned above that i used as the dns forwarder in the /etc/resolve.conf the dig works ..
what am i missing here ?
By default, the resolution of internal DNS names is handled by the Instance metadata server (169.254.169.254)
If you change the name server configuration for your Instance, you might not be able to use internal DNS names. Any replacement of the name server software must support the Local Subnet Routes feature of RFC 3442.