Leveraging an API for DNS updates

by scalingexperts

Download our Web Scaling eBook

Web Scaling vol. 1 - Small Architectures

DNS Updates

Back in the the day, human intervention was required for most DNS manipulations. Nowadays, many providers such as Linode offer an API for accessing and managing your domains. This means it is now possible to script the failover, by having an agent detect network changes and perform calls to an API in order to update DNS zone entries.

How do you do it?

I wrote a simple Ruby script which handles DNS zone updates. It is meant to run on a *NIX-based operating system such as Debian or OS X. The script is very simple, but it is more of a proof of concept than anything else.

The idea is to create an initial A record in a zone, and let the script run in the background, and update the zone when an IP address change is detected.

The mechanisms for detecting or requiring a change can be tweaked and scripted for even more automation, but the premise remains the same: no need to login to a website anymore to perform any sort of DNS manipulations.

Get the script here: