Created
February 27, 2018 06:36
-
-
Save vallamost/088cd5a8e96c7a4c02254c66931486c6 to your computer and use it in GitHub Desktop.
update the IP of an A record using the EC2 metadata information.
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
public_ipv4_address_of_server=$(curl http://169.254.169.254/latest/meta-data/public-ipv4 -s) && { cat > ./update_clickbuysmileArecord.json <<EOF | |
{ | |
"Comment": "update click buy smile domain with new A record IP", | |
"Changes": [ | |
{ | |
"Action": "UPSERT", | |
"ResourceRecordSet": { | |
"Name": "your_domain_name.com", | |
"Type": "A", | |
"TTL": 60, | |
"ResourceRecords": [ | |
{ | |
"Value": "$public_ipv4_address_of_server" | |
} | |
] | |
} | |
} | |
] | |
} | |
EOF | |
} && aws route53 change-resource-record-sets --hosted-zone-id your_domain_name.com_host's_id --change-batch file://update_clickbuysmileArecord.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment