Route 53 Dynamic DNS
From Notes
AWS Route 53 is not a very user friendly service, but is flexible and highly functional. Extending upon my notes related to the general use of AWS Route 53, I've started a small project to leverage Route 53 as a dynamic DNS service for my home network. The script provides basic functionality, however, I'm sure improvements could be made. If you are interested in contributing to the project, please contact me (rsigler at gmail dot com).
Contents |
Getting Started
- If you have not already done so, you must set up at least one domain with AWS Route 53.
- Next, you must properly configure your system to run the dnscurl.pl script.
- Lastly, download and gunzip the AWS Route 53 Dynamic DNS Updater Script: route53DynDNS.bash.gz
Editing the Script
A few settings need to be adjusted. Edit the script using vi (or, if you are not a real man, the editor of your choice). The top of the file contains three three variables which you will need to set.
#!/bin/bash ### User Settings (things you must set) ## Location of the dnscurl.pl script DNSCurl="/path/to/route53DynDNS/dnscurl.pl" ## The host name you wish to update/create myHostName="home" ## Zone/domain in which host (will) reside(s) myDomainName="example.org"
- First, set DNSCurl to the path of dnscurl.pl.
- Second, set myHostName to the name of the A record you wish to update/create.
- Thrist, set myDomainName to the name of the AWS Route 53 Zone/Domain you wish to use.
The rest of the script should function without edits.
Test Run
Once you have everything in place, manually run the script. You should see results. Verify the script updated Route 53 by using dig to query for the entry (your results will look different, but similar):
[rsigler@rsigler-linux ~]$ dig home.example.org ; <<>> DiG 9.8.0-P4-RedHat-9.8.0-7.P4.fc15 <<>> home.example.org ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48362 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 3 ;; QUESTION SECTION: ;home.example.org. IN A ;; ANSWER SECTION: home.example.org. 600 IN A 10.1.1.1 ;; AUTHORITY SECTION: example.org. 160626 IN NS ns-170.awsdns-21.com. example.org. 160626 IN NS ns-619.awsdns-13.net. example.org. 160626 IN NS ns-1288.awsdns-33.org. example.org. 160626 IN NS ns-1923.awsdns-48.co.uk. ;; ADDITIONAL SECTION: ns-170.awsdns-21.com. 160626 IN A 205.251.192.170 ns-619.awsdns-13.net. 160626 IN A 205.251.194.107 ns-1923.awsdns-48.co.uk. 160626 IN A 205.251.199.131 ;; Query time: 23 msec ;; SERVER: 192.168.86.1#53(192.168.86.1) ;; WHEN: Mon Aug 15 15:21:03 2011 ;; MSG SIZE rcvd: 245 [rsigler@rsigler-linux ~]$
Be sure to run the script a few times over a 30 minute period, just to make sure it works as expected.
Cron Job
Once you are happy with the results, set up a cron job to keep you A record up to date.
15 * * * * /path/to/route53DynDNS.bash > /dev/null
This example would execute the script every 15 minutes.

