Update your Domain Name (DNS) with a Dynamic IP and Amazon Route 53

Note: works also on a QNAP NAS

  • Install Python and pip (for QNAP you can find a how-to here).
  • Install the required libraries $ curl -o boto-2.27.0.tar.gz https://pypi.python.org/packages/source/b/boto/boto-2.27.0.tar.gz#md5=47a4d81554380b21d85005f91d12a585 -k $ pip install boto-2.27.0.tar.gz $ curl -o dnspython.zip https://pypi.python.org/packages/source/d/dnspython/dnspython-1.11.1.zip#md5=5829130ed557d6f2e1c3ca9ed01d337a -k $ pip install dnspython.zip `
  • Configure boto
    $ touch /etc/boto.cfg
    $ vim /etc/boto.cfg
    Add the following lines to boto.cfg:
    aws_access_key_id = <your_access_key_here>
    aws_secret_access_key = <your_secret_key_here>
    Note: you can find a cheatsheet on how to use vim here.
  • Install the script to update your DNS. The script is also available on Github here.
    $ cd /share/MD0_DATA]
    $ mkdir scripts
    $ cd scripts    $ curl -o dyndns_route53.py  https://gist.githubusercontent.com/glnds/11352999/raw/7958f754f4422ca09a8e338f231101cd845a31e3/dyndns_route53.py -k
  • Configure the script
    $ vim dyndns_route53.py
    * Change the following lines (more info about Amazon Hosted Zones is available here):
    # Settings, Change me!
    HOSTED_ZONE = 'ZXQU10000001'
    DOMAIN_NAME = 'home.mydomain.com'
    • Change the file permissions:
      $ chmod +x dyndns_route53.py
    • Test the script:
      $ ./dyndns_route53.py
  • Run your update script every 5 minutes
    $ vim /etc/config/crontab
    * Add the following line:
    */5 * * * * /share/MD0_DATA/scripts/dyndns_route53.py
    • Restart cron and reboot
      `$ /etc/init.d/crond.sh restart
      $ reboot 

Note: there seems to be a script available on the QNAP NAS just to retrieve your WAN ip, the script is located on your NAS under /etc/init.d/get_external_ip.sh.