Skip to content

Instantly share code, notes, and snippets.

@stephennancekivell
Last active August 22, 2021 06:53
Show Gist options
  • Save stephennancekivell/cd5a0b1f342b8914d6ca1551315e553f to your computer and use it in GitHub Desktop.
Save stephennancekivell/cd5a0b1f342b8914d6ca1551315e553f to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
IP=$(curl ifconfig.me)
echo "ip is $IP"
MSG="{
\"Changes\": [
{
\"Action\": \"UPSERT\",
\"ResourceRecordSet\": {
\"Name\": \"$RECORD_SET\",
\"Type\": \"A\",
\"TTL\": 60,
\"ResourceRecords\": [
{
\"Value\": \"$IP\"
}
]
}
}
]
}"
echo $MSG
aws route53 change-resource-record-sets --hosted-zone-id "$HOSTED_ZONE" --change-batch "$MSG" | cat
echo "$RECORD_SET set to $IP"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment