Last active
April 18, 2017 08:08
-
-
Save DagW/db886558c12077bbb1d570de2508a2d1 to your computer and use it in GitHub Desktop.
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 characters
#!/bin/bash | |
IP=$( /usr/bin/curl ipinfo.io/ip ) | |
USAGE=$(cat <<-END | |
{ | |
"Comment": "Update record to reflect new IP address of this RPI", | |
"Changes": [ | |
{ | |
"Action": "UPSERT", | |
"ResourceRecordSet": { | |
"Name": "domain.net.", | |
"Type": "A", | |
"TTL": 300, | |
"ResourceRecords": [ | |
{ | |
"Value": "${IP}" | |
} | |
] | |
} | |
} | |
] | |
} | |
END | |
) | |
echo "$USAGE" > /root/scripts/update_ip_to_r53.json | |
/usr/local/bin/aws route53 \ | |
change-resource-record-sets \ | |
--hosted-zone-id Z1KXXXXXXXXX \ | |
--change-batch file:///root/scripts/update_ip_to_r53.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment