Please contact your support team if you have a question or need assistance for any Rackspace products, services, or articles.
Does anyone know of an easy way to export a zone file in Cloud DNS?
There doesn't appear to be any shortcut on the control panel. I have reviewed the info for using an API call, but I am a bit confused on how to implement that way.
Any suggestions or help would be appreciated.
At this time you can only export DNS zones from Cloud DNS via the API. You can also contact support to have them export your DNS zones in bind9 format. Others might have some other suggestions as well...
I have contacted Support.
Just to add to this, you can do this through our API by using CURL and the full details of the request you will need to send can be found here.
I decided to give this a go and here's the process:
- Send the initial request to export the domain, just replace the ACCOUNTID, DOMAINID and TOKEN with your relevant details:
CURL -X GET https://lon.dns.api.rackspacecloud.com/v1.0/ACCOUNTID/domains/DOMAINID/export -H "X-Auth-Token: TOKEN" -H "Content-Type: application/xml" -H "Content-Length: 0"
- This will return an asynchronous request (which you can read about here) which will show the following details as an example:
<?xml version='1.0' encoding='UTF-8'?>
You'll notice that the above status shows as "RUNNING" meaning it's dealing with our request. We can now query the callbackUrl to find the details of the request.
- Query the callbackUrl by adding ?showDetails=True:
CURL -X GET https://lon.dns.api.rackspacecloud.com/v1.0/ACCOUNTID/status/457er0696-1bf0-4b85-8e03-1fba2cc26129?showDetails=true -H "X-Auth-Token: TOKEN" -H "Content-Type: application/xml" -H "Content-Length: 0"
- If the callbackUrl has finished "RUNNING" status and moved to "COMPLETED" then you should receive a response like this:
"contents": "reistest.com.\t\t300\tIN\tSOA\tns.rackspace.com. reis.awesome.rackspace.co.uk. 1372115361 21600 3600 1814400 300\nreistest.com.\t\t300\tIN\tNS\tdns1.stabletransit.com.\nreistest.com.\t\t300\tIN\tNS\tdns2.stabletransit.com.\n",
If you don't receive the BIND9 format export then you should check the status of the callbackUrl by adding the ?Status to the CURL command:
CURL -X GET https://lon.dns.api.rackspacecloud.com/v1.0/ACCOUNTID/status/457er0696-1bf0-4b85-8e03-1fba2cc26129?Status -H "X-Auth-Token: TOKEN" -H "Content-Type: application/xml" -H "Content-Length: 0"
If the status is still RUNNING then please wait for the job to complete, if it's in an "ERROR" status then try requesting a new export by using the initial CURL command. If you're still unable to get an export please contact support for us to investigate further.
Just one last important note from this:
"This call is for a single domain only, and as such, does not traverse up or down the domain hierarchy for details (that is, no subdomain information is provided)."
Please let me know if you experience any issues.
Sweet, thanks for this.
I will give it a try this weekend and let you know.
Appreciate the help and feedback!
Just found this gist from DavidWittman: https://gist.github.com/DavidWittman/4727690
In order to use his script, you need to first install python-clouddns:
sudo pip install python-clouddns
Then edit the script and add your username, apikey, and the directory you want the bind9 files to be placed. When you run the script, it will loop through all your domains and export them to the local directory you choose.