Update Amazon Route53 via python and boto

April 18, 2012 at 08:00 AM

I wrote a python script to update DNS on Amazon Route53. You can use it on dynamic hosts by putting it into cron, or on boot for cloud instances with inconsistent IP addresses.

It uses the boto Amazon Web Services python interface for the heavy lifting. You'll need that installed. (Arch Linux has a python-boto package)

You need to edit the script to place your AWS credentials in the two variables near the top of the script (awskeyid, awskeysecret). Then it's ready to go.

You can specify the hostname as an argument on the command line:

        updatedns.py myhost.mydomain.com

        ...or it will try and resolve the hostname itself.

You can download the script here, or from github.

Permanent Link — Posted in Cloud Computing, Geek Tactics, Amazon Web Services