Skip to content

Instantly share code, notes, and snippets.

@li0nel
Last active November 18, 2019 06:06
Show Gist options
  • Save li0nel/4563f8d909e808169c91a5521569ff10 to your computer and use it in GitHub Desktop.
Save li0nel/4563f8d909e808169c91a5521569ff10 to your computer and use it in GitHub Desktop.
Creating our Let's Encrypt hook script
aws route53 wait resource-record-sets-changed --id \
$(aws route53 change-resource-record-sets --hosted-zone-id \
"$(aws route53 list-hosted-zones-by-name --dns-name $2. \
--query HostedZones[0].Id --output text)" \
--query ChangeInfo.Id \
--output text \
--change-batch "{ \
\"Changes\": [{ \
\"Action\": \"$1\", \
\"ResourceRecordSet\": { \
\"Name\": \"_acme-challenge.${CERTBOT_DOMAIN}.\", \
\"ResourceRecords\": [{\"Value\": \"\\\"${CERTBOT_VALIDATION}\\\"\"}], \
\"Type\": \"TXT\", \
\"TTL\": 30 \
} \
}] \
}" \
)
@kaganar
Copy link

kaganar commented Nov 18, 2019

This script works fine -- in my case, errors came down to user error and not reading carefully enough. I think some of the confusion is that it's written for certbot to invoke, not manually and without arguments (hence the invalid XML operation error), and it requires modification to use your domain (as mentioned in article at Hackernoon, hence the mydomain.com related errors). Additionally, you must have Route 53 set up (as mentioned in the article).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment