Created
March 6, 2016 02:59
-
-
Save kulp/7c3c33e8b8b70252efe6 to your computer and use it in GitHub Desktop.
Revisions
-
kulp created this gist
Mar 6, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ #!/bin/sh -e HOSTED_ZONE_IP=/hostedzone/CHANGEME DOMAIN=CHANGEME TTL=300 my_ip=$HOME/.my_ip IP=$(dig +short myip.opendns.com @resolver1.opendns.com) if [ "$IP" = "$(cat $my_ip)" ] then exit 0 fi json=$(cat <<EOF { "Changes": [ { "Action": "UPSERT", "ResourceRecordSet": { "Name": "$DOMAIN", "Type": "A", "TTL": $TTL, "ResourceRecords": [ { "Value": "$IP" } ] } } ] } EOF ) aws route53 change-resource-record-sets --hosted-zone-id $HOSTED_ZONE_IP --change-batch "$json" echo "$IP" > $my_ip