Skip to content

Instantly share code, notes, and snippets.

@jimmycuadra
jimmycuadra / hook.sh
Created January 21, 2016 01:35
letsencrypt.sh hook script for dns-01 challenge using AWS Route 53
YOUR_HOSTED_ZONE_HERE="Route53 zone ID"
case "$1" in
"clean_challenge")
altname="$2"
challenge_token="$3"
keyauth_hook="$4"
aws route53 change-resource-record-sets --hosted-zone-id $YOUR_HOSTED_ZONE_HERE --change-batch "{\"Changes\":[{\"Action\":\"DELETE\",\"ResourceRecordSet\":{\"Name\":\"_acme-challenge.${altname}\",\"Type\":\"TXT\",\"TTL\":60,\"ResourceRecords\":[{\"Value\":\"\\\"${keyauth_hook}\\\"\"}]}}]}"
;;