Migrate Domain DNS from DigitalOcean to GCP Cloud DNS

I had to recently migrate the DNS configurations (A, AAAA CNAME, TXT, MX, etc. records) for a particular domain from DigitalOcean to Google Cloud Platform Cloud DNS. Doing it is really simple – you just need to export the zone file from DO and then import the same into GCP Cloud DNS (using the gcloud cli).

Exporting DNS Zone File in DO

  1. Login to your DigitalOcean control panel.
  2. In the main menu, click on Networking > Domains.
  3. Open the More menu and click on Download zone link. This should download your zone file.
DigitalOcean Export Domain Zone File

Import DNS Zone File into GCP Cloud DNS

Before importing the downloaded zone file into Cloud DNS, I personally got rid of the SOA and main NS records from it because the corresponding records already existed in my pre-created Cloud DNS zone. You might want to do the same.

If your DNS zone in Cloud DNS is not already created, then create a managed zone with the gcloud cli (can also do it from the GCP web console):

gcloud dns managed-zones create EXAMPLE_ZONE_NAME \

Once the zone is created, import the downloaded (and optionally modified) zone file from the previous step:

gcloud dns record-sets import -z=EXAMPLE_ZONE_NAME --zone-file-format path-to-example-zone-file

That should be it!


Leave a Reply

Your email address will not be published. Required fields are marked *