DynR53

From Notes

Jump to: navigation, search

dynR53 is a simple bash script which checks/updates the detected public facing IP address of you system as it relates to a predefined AWS Route 53 hosted zone DNS entry. Basically, it's dynamic DNS for AWS Route 53!

Contents

Disclaimer

The script is written for Red Hat style Linux distributions (but should work fine on most any *nix flavor), is open source, free to use and free to modify. I am, by no means, a professional developer- the script may contain bugs and inefficiencies (just fair warning). Constructive feedback is greatly appreciated; code contributions would be awesome.

Download

Grab a copy of the script here: http://cdn.improvisedscience.org/cdn/projects/dynR53/dynR53.tgz

Prerequisites

  1. perl-XML-Xpath
  2. perl-Digest-HMAC
  3. dnscurl.pl for AWS Route 53 and its prerequisites http://aws.amazon.com/code/Amazon-Route-53/9706686376855511
  4. An AWS account along with your AWS id and key (see my AWS credentials article)
  5. A public domain name already hosted by Route 53 (see my Route 53 article to get started)

Getting Started

After untar'ing the package, check out the README file; you'll need to make a few basic modifications to fit your environment:

  1. Ensure the above listed prereq's are in place.
  2. If you don't already have an aws-secrest file in place, modify the one provided by the tarball by adding your AWS id and key.
  3. Edit dynR53.bash; some initial variables need to be set:
    • DNSCurl: set to the full path of the dnscurl.pl script
    • myHostName: the host name you wish to check/update (ie: "home")
    • myDomainName: the domain hosted by Route 53 in which your host RR will reside (ie: "example.com"; therefore, the RR home.example.com would become your dynamic RR)
  1. Next, you may wish to modify a few other variables:
    • myTTL: the time to live for the RR, in seconds.
    • route53API: you shouldn't need to change this unless/until the Route 53 is updated by AWS; but then this entire script may become broken. If you change this var, also change the next one...
    • route53APIDoc: you shouldn't need to change this unless/until the Route 53 is updated by AWS; but then this entire script may become broken. If you change this var, also change the previous...

That's it! Run the script. If all goes well, set up a cronjob:

15 * * * * /usr/local/dynR53/dynR53.bash > /dev/null

This job will check/update your public IP and dynamic RR every 15 minutes.

Personal tools