Thank you for visiting the Rackspace Community
The The Community is live! Post new content or topics so our teams can assist.

Please contact your support team if you have a question or need assistance for any Rackspace products, services, or articles.

Cloud DNS Zone File

This question is answered.

Hello-

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.

Thank you!

Verified Answer
  • Hello Aaron!

    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...

    Thanks!

    spurs

  • Hey Aaron,

    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'?>
    <ns2:asyncResponse
        xmlns:ns3="http://www.w3.org/2005/Atom"
        xmlns:ns2="http://docs.rackspacecloud.com/dns/api/v1.0"
        xmlns="http://docs.rackspacecloud.com/dns/api/management/v1.0">
        <ns2:jobId>45253d0696-1bf0-4b85-8e03-1fba2cc26129</ns2:jobId>
        <ns2:callbackUrl>https://lon.dns.api.rackspacecloud.com/v1.0/ACCOUNTID/status/457er0696-1bf0-4b85-8e03-1fba2cc26129</ns2:callbackUrl>
        <ns2:status>RUNNING</ns2:status>
        <ns2:requestUrl>https://lon.dns.api.rackspacecloud.com/v1.0/ACCOUNTID/domains/DOMAINID/export</ns2:requestUrl>
        <ns2:verb>GET</ns2:verb>
    </ns2:asyncResponse>

    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:

    {
        "response": {
            "id": 3712186,
            "contentType": "BIND_9",
            "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",
            "accountId": 10118579
        },
        "status": "COMPLETED",
        "verb": "GET",
        "jobId": "b87f134e-73b4-441a-94a9-9637d32579b7",
        "callbackUrl": "https://lon.dns.api.rackspacecloud.com/v1.0/ACCOUNTID/status/457er0696-1bf0-4b85-8e03-1fba2cc26129",
        "requestUrl": "https://lon.dns.api.rackspacecloud.com/v1.0/ACCOUNTID/domains/DOMAINID/export"
    }

    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.

    Regards,

    Reis

All Replies
  • Hello Aaron!

    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...

    Thanks!

    spurs

  • Thanks Spurs

    I have contacted Support.

    -Aaron

  • Hey Aaron,

    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'?>
    <ns2:asyncResponse
        xmlns:ns3="http://www.w3.org/2005/Atom"
        xmlns:ns2="http://docs.rackspacecloud.com/dns/api/v1.0"
        xmlns="http://docs.rackspacecloud.com/dns/api/management/v1.0">
        <ns2:jobId>45253d0696-1bf0-4b85-8e03-1fba2cc26129</ns2:jobId>
        <ns2:callbackUrl>https://lon.dns.api.rackspacecloud.com/v1.0/ACCOUNTID/status/457er0696-1bf0-4b85-8e03-1fba2cc26129</ns2:callbackUrl>
        <ns2:status>RUNNING</ns2:status>
        <ns2:requestUrl>https://lon.dns.api.rackspacecloud.com/v1.0/ACCOUNTID/domains/DOMAINID/export</ns2:requestUrl>
        <ns2:verb>GET</ns2:verb>
    </ns2:asyncResponse>

    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:

    {
        "response": {
            "id": 3712186,
            "contentType": "BIND_9",
            "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",
            "accountId": 10118579
        },
        "status": "COMPLETED",
        "verb": "GET",
        "jobId": "b87f134e-73b4-441a-94a9-9637d32579b7",
        "callbackUrl": "https://lon.dns.api.rackspacecloud.com/v1.0/ACCOUNTID/status/457er0696-1bf0-4b85-8e03-1fba2cc26129",
        "requestUrl": "https://lon.dns.api.rackspacecloud.com/v1.0/ACCOUNTID/domains/DOMAINID/export"
    }

    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.

    Regards,

    Reis

  • 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.

    SPURS