Using free Yandex DNS service in an automated way


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. whenever I needed a DNS name for my public endpoints. But this approach has two drawbacks:

  1. To use if for free you have to manually prolong you hostname once in a month. Drove me mad every time!
  2. In PoCs/trials you want your domain represent your product. Using in 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 robustfree 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:

  1. Create a Yandex Passport account
  2. Delegate your domain to Yandex and confirm domain ownership
  3. Start playing with DNS records via Web UI right away
  4. Want to use API?
    1. Get admin’s token
    2. Read the API docs and you are all set!

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.

yadm demo

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.

Roman Dodin

Network engineer at Nokia
Eagerness to learn multiplied by passion to share.
You can reach me at LinkedIn

You Might Also Like