Skip to content

Instantly share code, notes, and snippets.

@DagW
Last active April 18, 2017 08:08
Show Gist options
  • Save DagW/db886558c12077bbb1d570de2508a2d1 to your computer and use it in GitHub Desktop.
Save DagW/db886558c12077bbb1d570de2508a2d1 to your computer and use it in GitHub Desktop.
#!/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