Skip to content

Instantly share code, notes, and snippets.

@johnjones4
Last active November 22, 2016 03:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnjones4/1a9c4326b6f4023b54bf6898c4ddfab5 to your computer and use it in GitHub Desktop.
Save johnjones4/1a9c4326b6f4023b54bf6898c4ddfab5 to your computer and use it in GitHub Desktop.
0 1 * * * /usr/bin/updateDomain.sh
#!/bin/bash
ZONE=AABBCCDDEEFFGG
DOMAIN=dynamic.example.com
IP="$(dig +short myip.opendns.com @resolver1.opendns.com)"
aws route53 change-resource-record-sets --hosted-zone-id "$ZONE" --cli-input-json "{ \"HostedZoneId\": \"${ZONE}\", \"ChangeBatch\": { \"Changes\": [ { \"Action\": \"UPSERT\", \"ResourceRecordSet\": { \"Name\": \"${DOMAIN}.\", \"Type\": \"A\", \"TTL\": 300, \"ResourceRecords\": [ { \"Value\": \"${IP}\" } ] } } ] }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment