Migration to Google Cloud Dns from different provider.
dns
gcp
python
Decision to pick DNS provider should be, in my opinion, based on currently used cloud environment.
If you use AWS then Route53
, GCP then Cloud Dns
, etc. It’s easier to manage it and audit then.
Not the case for multicloud usage but most of the companies I worked for were using single cloud.
If DNS domain was registered before cloud adoption then your task might be to migrate DNS. Such migration is not
uncommon and in this blog post I will write about changing NS
records from godaddy
to google Cloud Dns
.
DNS NS records
NS record delegates a DNS zone to use the given authoritative name servers. It usually have long TTL as changing it is
not frequent and it’s preventing frequent queries from clients.
More information in related RFC
You can check your current NS servers with dig
command:
Migration plan
There is a documentation about migration.
Here is my plan:
- Replicate records from
goddady
toCloud Dns
- Lower TTL on
goddady
NS records - Wait for
Cloud Dns
to have new records available - Check if all records are the same for those two providers
- Change
goddady
NS records to pointCloud Dns
ones - Wait for propagation
Migration execution
- Unfortunately our provider didn’t provide way to export records so it was manual job to create them in terraform.
- Unfortunately it’s not possible to change TTL of NS record in
goddady
- To check if records have propagated correctly and to avoid any human error I made a
python
script checking if DNS records are matching for different resolvers.
To be able to use it you need to install additional python
libraries:
Here is a script:
When all records match we are ready for migration.
- Change NS records in
godaddy
to match your zone in GCP
- Wait for propagation periodically checking if NS record have changed:
Worst case scenario: it will take longer than TTL set on current NS records. Be prepared for that.
- Enjoy DNS in GCP!
Thoughts
Migrating DNS is not rocket science but needs to be executed with caution, especially for already used domains that
are serving production traffic.
Migrating DNSSEC is more complicated but is also out of the scope of this post.
I hope someone will find my execution plan and python
snippet useful.
Note: I’m not affiliated in any way with icanhas.cheezburger.com
3h4x