-
-
Save jmiserez/8eb2f2f126f6d4c8b8e9 to your computer and use it in GitHub Desktop.
Dynamic DNS for Amazon Route53, using cli53 and remote OpenDNS resolver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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