Exporting Libcloud DNS zone to BIND zone file format and migrating between DNS providers
Because of the reliability issues and pretty much non-existent and non-responsive customer service (if you don’t believe me, check Twitter which is full of complaints) I migrated some of my domains away from Zerigo to a different DNS provider. To do that, I wrote a simple Python script which allows you to export Libcloud DNS zone to a BIND zone file format.
Motivation & History
I have been Zerigo user for almost 4 years now. One of the primary reasons why I have migrated most of my domains to Zerigo back then was that they were one of the first DNS providers which offered a simple management REST API.
At the beginning things were working flawlessly, but after the acquisition by 8x8 things have started degrading. Things have became especially bad in the last year or so. During that time Zerigo has been a target of multiple DDoS attacks which took down majority or all of their DNS servers (1, 2). Those attacks caused a major disruptions for a lot of Zerigo DNS users.
Recently Zerigo posted an announcement where they said that they have implemented multiple measures to improve their DNS servers reliability. Sadly, as displayed a couple of weeks ago when they were a target of another DDoS attack, those measurements didn’t help. The problem is that most of the measurements they have implemented are just small patches which don’t address a root cause. To improve the reliability of their service, the first step they would need to take is to move all of their DNS servers to Anycast. Anycast has long been used by many commercial DNS providers to increase performance and availability.
Exporting Libcloud DNS zone to BIND zone file format
Yesterday I have decided to migrate more of my domains to a different provider. To expedite the migration I wrote a simple Python script which can take a Libcloud DNS zone and create a BIND zone file for it.
Advantage of this approach over writing a script which uses Libcloud to directly re-create all the records under a different provider is that it’s more efficient and as an output you get a file which you can use with any DNS software or provider which supports BIND zone file format.
Keep in mind that a similar thing can be achieved by using a dig
tool (dig
+nocmd example.com any +multiline +noall +answer
). The problem with dig
approach is that unless zone transfers are enabled for your IP address, you
won’t receive all the records back.
Aforementioned script can be found on Github.
Usage
To use this script and create a BIND zone file, follow the steps bellow:
- Install the Python package
The script is so simple I haven’t decided to publish it to PyPi yet. I plan to start a discussion on the Libcloud mailing list and if more people find it useful and are OK with that, I will include this functionality in the core.
- Take a look at example.py and modify it to suit your needs. For example:
Keep in mind that you can replace Zerigo with any other provider supported by Libcloud.
- Run the code
(yes, Libcloud works just fine under PyPy)
Here is an example output for one of my domains: