Skip to content

Instantly share code, notes, and snippets.

@Malvineous
Created January 28, 2017 06:42
Show Gist options
  • Save Malvineous/de75b8b0be4cd7332239f0146a46c59f to your computer and use it in GitHub Desktop.
Save Malvineous/de75b8b0be4cd7332239f0146a46c59f to your computer and use it in GitHub Desktop.
One-liner for Dynamic DNS with Amazon Route53
# One liner for dynamic DNS with Amazon Route53
# Public domain 2017 Adam Nielsen <malvineous@shikadi.net>
#
# Run it from cron to keep your IP up to date.
# Requires Amazon CLI installed.
#
# TARGET_ZONEID: AWS Zone ID where the domain entry will go.
# TARGET_FQDN: DNS entry to create/update in the zone.
TARGET_ZONEID="Z12345"; TARGET_FQDN="home.example.com."; echo '{ "Comment": "DDNS update", "Changes":[ { "Action": "UPSERT", "ResourceRecordSet": { "ResourceRecords": [ { "Value": "'`dig +short myip.opendns.com @resolver1.opendns.com`'" } ], "Name": "'"$TARGET_FQDN"'", "Type": "A", "TTL": 60} } ] }' | aws route53 change-resource-record-sets --hosted-zone-id "$TARGET_ZONEID" --change-batch file:///dev/stdin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment