Introduction to using the K5 IaaS DNS as a Service

In this blog, I’m going to talk you through getting started with using the K5 DNS as a Service. This service provides an environment for running zone management and record management operations via the API, without the need to build and manage your own DNS server.

To get started, you need to own and have registered your own public Domain Name. For the purpose of this blog, I have registered the domain with

Managing DNS Zones

The first thing you need to do is create a new DNS zone within your project using the API. To start, open up your K5 API environment and obtain your authentication token. Next, run the following command to list any/all existing zones for your project:

If this is the first time you have configured DNS, you should see the following information, indicating no zones are present:


Use the following command to create a DNS Zone, substituting “” for your registered DNS name:


If successful, the output of this command will include an ‘Unauthorized’ error and a confirmation code, that you must use to verify/prove that you are the domain owner. There are two methods for doing this, the first if your domain is not yet managed by any DNS yet, and second if it is managed by DNS. As my domain “” is currently managed by Godaddy, I will use the second method.

This second method requires that you create a DNS TXT record within your  existing DNS , so in my case Godaddy. The value of this text record is of the form: nifty-dns-verify=.

e.g. nifty-dns-verify=<RANDOMCHARACTERS>

The below screen shot shows how this record is created within Godaddy:


Once done, running the Create DNS Zone command again should result in output as shown below. For troubleshooting, you can verify what TXT records are being returned from your domain using an online tool such as or”NSLookup.exe -q=TXT”


Now the DNS zone is verified, you can update the Nameservers for your existing managed Domain, to point to the K5 Name Servers shown above. The below screenshot shows how this is done within Godaddy, by choosing ‘custom’, entering the nameservers and clicking ‘save’ (note this may take up to an hour or two to complete):


Further Information:

For information, the registered DNS zone can be deleted with the following command (substituting “” with your own domain name)

Managing Records

Now that the DNS Zone is configured, DNS records can be added to it. To list any existing DNS records, enter the following command (substituting “” for your domain):

The following output is displayed for an empty DNS Zone:


To help get you started, the following example shows you how to add basic A, TXT, CNAME and MX records. Remember to substitute your domain for “”. I’ll cover more advanced features like Latency-based routing and failover in subsequent blogs.

  • To add an A record, use the following command :

In the above example, I am setting the A record to to refer to the public IP Address of my webserver on

  • To add a TXT record, use the following command:
  • To add a CNAME record, use the following command:
  • To add a MX record, use the following command:

Further Information:

To delete a particular record, resubmit the same command only this time change the Action to Delete:

The entire DNZ zone can be deleted with the following command:

curl -X DELETE $DNS/v1.0/hostedzone/<DOMAIN NAME> -H “X-Auth-Token:$OS_AUTH_TOKEN” -H “Content-Type:application/xml”  | xmllint –format –