Per this earlier post, I was able to verify a domain of ours (which is in Route 53) to use as a custom domain with GCPs Cloud Run. However, we are struggling to update the DNS records for this domain now.
Our domain mydomain.com
was previously used with an AWS EC2 instance. Our hosted zone in Route 53 for this domain currently has 8 records, of various record types (A, MX, NS, SOA, TXT, CNAME). Before uploading the 8 DNS records for cloud run (GCP gave us 4 A
DNS records with ip addresses, and 4 AAAA
DNS records with ip addresses, to upload), should I first delete all of the previous records in the hosted zone for this domain? I presume these earlier records are associated with our previous use of the domain with the ec2 instance.
Is it safe to delete all of the previous records from the hosted zone? Or maybe it is better to create a new hosted zone to use with GCP cloud run, and keep this initial hosted zone to remain with the EC2 instance? I am not sure if it is possible to have 2 hosted zones for 1 domain, or not. If only 1 zone is possible, I am not sure if i should delete + re-create a new hosted zone to use with Cloud Run, or try to edit my initial hosted zone (by deleting the old DNS records). I just need to move this custom domain from the EC2 instance to the cloud run app.
Thanks!
EDIT BEFORE BOUNTY: here are the DNS records that Cloud Run is telling me to add to my domain host (true values and domain name changed):
... and here is my Hosted Zone for the domain:
...the top 2 records are the new A and AAAA records that Cloud Run has given me (there was previously 2 A records that I deleted). When trying to create the A records, I actually received an error when I tried to create 4 separate A records, so I've put all 4 IP addresses into a single A record (not sure if this is correct).
Unfortunately, in the GCP /run/domains page, I am still receiving this error / warning message:
I do not plan to use the old AWS EC2 instance with this domain again, so perhaps I should delete all of the old DNS records that are associated with it? However I am not sure which records are safe to remove and which are not... Perhaps creating a new hosted zone is best (as suggested in an answer below)? Currently I am going the route of simply editing my old hosted zone (as was suggested in the comment below).
We have been struggling with this for most of the weekend and could really use some advice on getting this domain off of the EC2 instance and onto the cloud run deployment.
Edit2: I did just update the hosted zone with the cloud run DNS records a few minutes ago, so perhaps I just need to give it time? Again, I am not sure at all...
I will point out two most obvious ways and their pros/cons.
1. Safest way
You can create a new managed zone (GCP's equivalent to AWS hosted zones), create all the needed records for your cloud run app in GCP. Then change at your domain registrar DNS servers that you got from GCP (probably something like ns-cloud-a1.googledomains.com
).
This way you will have full working copy (with setting to accomodate GCP's Cloud run) and in case you wanted to go back to AWS quickly you just need to point to AWS DNS servers at your domain registrar.
Cons of this solution are that you will have to pay a little bit more because you will be effectively hosting your domain at two providers (but only GCP will be actively used).
2. Easy way.
Create new managed zone at GCP, point your domain to GCP's DNS servers and delete hosted zone at AWS.
You can also backup your hosted zone in AWS - you can have a look at this blog post how to do it.
In my opinion if you ever plan to go back (or have a backup) of your domain records setup for AWS then first approach is the one to go for. Additional cost is also negligible.
UPDATE
Any changes made in DNS settings (adding & removing records, modyfying) requite usually up to 24 hours to propagate across the Internet.
Even more about DNS records and how to manage them.
If you want to add multiple A records to your managed zone edit your zone, click on "add record set" button, next select A
record type (or AAA
for IPv6 and type in the address
first value, next click "add item" button below and type another etc.
If you prefer to do it using gcloud
the here's some documentation how to add records to your zone (domain).