This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -eo pipefail | |
## Allows for creation of "Basic" DNS records in a Route53 hosted zone | |
function main() { | |
record_name=$1 | |
record_value=$2 | |
[[ -z $record_name ]] && echo "record_name is: $record_name" && exit 1 | |
[[ -z $record_value ]] && echo "record_value is: $record_value" && exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unix_todate=$(date -d "${todate}" "+%s") | |
getDomainName() { | |
echo $1 | cut -d'/' -f 5 | |
} | |
for pem in /etc/letsencrypt/live/*/cert.pem; do | |
if [ $(date --date="$(openssl x509 -enddate -noout -in "$pem"|cut -d= -f 2)" "+%s") -le $unix_todate ]; | |
then | |
domain=$(getDomainName $pem) | |
printf 'deleting cert %s expired: %s\n' \ | |
"$domain" \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#place in /etc/letsencrypt/renewal-hooks/post | |
export AWS_ACCESS_KEY_ID=XXX | |
export AWS_SECRET_ACCESS_KEY=XXX | |
#certs must be in us-east-1 to use with cloudfront | |
export AWS_DEFAULT_REGION=us-east-1 | |
#run without --certificate-arn first time then specify arn for updates | |
aws acm import-certificate --certificate file:///etc/letsencrypt/live/site.com/cert.pem --private-key file:///etc/letsencrypt/live/site.com/privkey.pem --certificate-chain file:///etc/letsencrypt/live/site.com/chain.pem --certificate-arn specifyarnforupdate |