How to transfer DNS domains from Linode DNS manager to DigitalOcean
I prefer to use the ISP DNS servers instead of running my own, so I had a dozen domains served by the excelent Linode DNS manager. I've been a loyal Linode customer for years but DigitalOcean's offer is too good to ignore.
DigitalOcean also has a DNS manager, but migrating all domains manually would be painful - so I wrote this script. If you are procrastinating your migration because of this, you don't have this excuse anymore. :-)
- Python
- Python requests library
- Git
- Linode API key
- Digital Ocean client ID and API key
- Install Linode API bindings
Looks like linode-python
is not on the Cheese Shop, so you have to clone the repo:
git clone https://github.com/tjfontaine/linode-python
Install:
pip install linode-python
- Install Requests
Requests is a Python library for making HTTP requests.
pip install requests
- Get your Linode API key
Use your Linode username and password to get an API key:
linode-python/linode/shell.py --user_getapikey --username=jdoe --password=thisisasecret
Replace jdoe
and thisisasecret
with your username and password and the result should be like:
{
"USERNAME": "jdoe",
"API_KEY": "ArbPtegl213ltegj32eegy1FrTfg7nS1kgVSQjwwJaBZb93bu9Pr3c6DgWc"
}
- Get your client ID and API key for DigitalOcean
Go to https://cloud.digitalocean.com/api_access
- Run the script
Download this script at https://github.com/scardine/linode2do/ and run it.
Example:
$ python linode2do.py
Enter your Linode API key: ArbPtegl213ltegj32eegy1FrTfg7nS1kgVSQjwwJaBZb93bu9Pr3c6DgWc
Enter your DigitalOcean client: BscQufhm213mufhk32ffhz1Gs
Enter your DigitalOcean API key: 8860836ac947c9bcec862ec119df3464
Transfering example.com
Record: MX ASPMX5.GOOGLEMAIL.COM
Record: MX ASPMX.L.GOOGLE.COM
Record: A 173.255.238.47
Record: MX ASPMX2.GOOGLEMAIL.COM
Record: MX ALT2.ASPMX.L.GOOGLE.COM
Record: MX ALT1.ASPMX.L.GOOGLE.COM
Record: MX ASPMX3.GOOGLEMAIL.COM
Record: MX ASPMX4.GOOGLEMAIL.COM
...
- Go grab a coffee
Get yourself a drink while the script copy all your domains from Linode DNS manager to Digital Ocean.
It should be trivial to modify this script to replace the IP addresses from the Linode host for the Digital Ocean ones, but I prefer to do this step by hand so it is left as an exercise for the reader.