This DNS story started when I bought a domain with a specific need — to dynamically create and delete DNS records for Nuage Networks components we use during Proof Of Concepts and customers trials.
Earlier I used to rely on Dynamic DNS services (i.e. no-ip.com) whenever I needed a DNS name for my public endpoints. But this approach has two drawbacks:
- To use if for free you have to manually prolong you hostname once in a month. Drove me mad every time!
- In PoCs/trials you want your domain represent your product. Using
hostname.ddns.netin front of a customer is not something that speaks well for your product. And we all know that devil is in the details.
Therefore I decided to buy a domain that will represent a product we are offering and park it to some provider which offers robust, free and API-enabled DNS service. Google cloud DNS and DynDNS while being both cheap are not free. So I kept looking and ended up with Yandex DNS which has all three traits I was looking for. Lastly I automated this DNS workflow so everyone in my team could provision their own DNS entries via one shared tool.
You got it right, in this post I am going to tell you about a completely free DNS service from Yandex with a decent API you can use for your personal needs. And yes, this post is accompanied with a python script which leverages API and automates DNS records provisioning.
Before you start playing with API
Signing up your domain with Yandex DNS is easy:
- Create a Yandex Passport account
- Delegate your domain to Yandex and confirm domain ownership
- Start playing with DNS records via Web UI right away
- Want to use API?
Yandex DNS manager (yadm)
Entering one record at a time via Web UI might be ok for long-lasting entries. In my case this was not an option since most records were meant to live for a couple of weeks and we need to be able to push multiple entries at a time in an automatic fashion. That’s how I ended up developing a simple script called
Yadm does a simple, yet useful job:
- takes in a text file with DNS entries (yaml formatted Local DNS Databse)
- checks if any duplicates are in Local DNS Database
- Grabs entries from Remote DNS Database and compares local record-set with the records that already in Remote DNS Database
- Adds or Deletes entries from Remote DNS Database to keep it aligned with Local DNS Database
This allows me to share my domain with the team and enables us to manage DNS entries by using one file which acts as a source of truth for the domain.
Script related documentation can be found in the GitLab repository.