Created
January 28, 2017 06:42
-
-
Save Malvineous/de75b8b0be4cd7332239f0146a46c59f to your computer and use it in GitHub Desktop.
One-liner for Dynamic DNS with Amazon Route53
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
# One liner for dynamic DNS with Amazon Route53 | |
# Public domain 2017 Adam Nielsen <[email protected]> | |
# | |
# 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