Created
October 16, 2019 19:50
-
-
Save leonaugusto16/deab47d9fa51de4416d8c656f10d86ab 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/sh | |
ip_private=$(curl http://169.254.169.254/latest/meta-data/local-ipv4) | |
dns_name="<YOUR_DNS>" | |
template='{"Comment": "UPSERT record machines ","Changes": [{"Action": "UPSERT","ResourceRecordSet": {"Name":"%s","Type": "A","TTL": 300,"ResourceRecords": [{"Value": "%s"}]}}]}' | |
json_string=$(printf "$template" "$dns_name" "$ip_private") | |
echo $json_string > change-batch.json | |
aws route53 change-resource-record-sets --hosted-zone-id <ID_ZONE> --change-batch file://change-batch.json | |
rm -rf change-batch.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment