Skip to content

Instantly share code, notes, and snippets.

@vallamost
Created February 27, 2018 06:36
Show Gist options
  • Save vallamost/088cd5a8e96c7a4c02254c66931486c6 to your computer and use it in GitHub Desktop.
Save vallamost/088cd5a8e96c7a4c02254c66931486c6 to your computer and use it in GitHub Desktop.
update the IP of an A record using the EC2 metadata information.
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