ruby

Updating GoDaddy DNS Entries with Ruby

I bought a new (arguably better) domain for my blog now! If you’re reading this, you’ve probably noticed, but it is therubyist.org, because I’m a fan of Ruby. The old name won’t be going anywhere, at least for the time being. Given the purchase of this new domain, I have several domains I need to maintain. Since I run this blog (and a few other services) from my home server which has a dynamic IP, setting up the domain apex (i.e., “naked domain”) is tricky. I’ve been using a dynamic DNS service called duckdns.org which gets the job done for subdomains since I can just CNAME to my personal DuckDNS subdomain, but it doesn’t solve this apex problem.

I decided that I was tired of doing this manually and that I would try to write a script. It would be appropriate, given my blog’s new domain name, to write it in Ruby. I did a quick DuckDuckGo search and noticed that someone wrote a GoDaddy SDK for Ruby. Yes, I use GoDaddy for my DNS… not necessarily endorsing them, but they seem to work well for my needs, especially now that I’ve discovered that they offer RESTful APIs.


First, I needed to set up some API keys. That’s done here. Create a key and secret and keep them handy. Create a script (I called mine set_domain_apex.rb) with something like the following:

Running this should output something like…

That’s it! Now, just set up cron to run this script every hour or so (or get really fancy and making it run whenever the DHCP client updates your IP). Enjoy.

One thought on “Updating GoDaddy DNS Entries with Ruby”

Comments are closed.