Skip to content

Instantly share code, notes, and snippets.

@jmiserez
Forked from PaulMaddox/noip
Last active April 17, 2016 14:19
Show Gist options
  • Save jmiserez/8eb2f2f126f6d4c8b8e9 to your computer and use it in GitHub Desktop.
Save jmiserez/8eb2f2f126f6d4c8b8e9 to your computer and use it in GitHub Desktop.
Dynamic DNS for Amazon Route53, using cli53 and remote OpenDNS resolver
#!/bin/bash
# Original author: https://gist.github.com/PaulMaddox/9210543
# Requires cli53 to be installed
# https://github.com/barnybug/cli53
DNS_NAME="home";
DNS_ZONE="example.com";
# not needed, we have a ~/.boto file
#export AWS_ACCESS_KEY_ID=
#export AWS_SECRET_ACCESS_KEY=
export BOTO_CONFIG=/home/ubuntu/.boto
NS=$(dig +short NS $DNS_ZONE | head -1)
DNS=$(dig @$NS +short ${DNS_NAME}.${DNS_ZONE});
IP=$(dig +short @resolver1.opendns.com myip.opendns.com);
if [ "$IP" != "$DNS" ]; then
echo "Update required: Our IP is $IP but our DNS record points to $DNS";
cli53 rrcreate --replace $DNS_ZONE "$DNS_NAME 60 A $IP" # updated syntax for latest cli53
else
echo "No update required";
exit 0;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment