Created
March 7, 2018 17:33
-
-
Save suhussai/cf5267d719b3b38d9a395be28a77dddc to your computer and use it in GitHub Desktop.
Automatically create an AWS managed certificate via the AWS Certificate Manager (ACM) and print out the certificate's validation emails. (Uses aws-cli/1.14.51)
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 | |
# Usage | |
# bash cert_creator.sh *.example.com | |
# | |
DOMAIN_NAME=$1 | |
echo "Starting script..." | |
echo "creating cert for $DOMAIN_NAME. Press enter to continue..." | |
read | |
cert_arn=$(aws --region us-east-1 acm request-certificate --domain-name $DOMAIN_NAME --validation-method EMAIL | jq '.CertificateArn') | |
cert_arn=$(sed -e 's/^"//' -e 's/"$//' <<<"$cert_arn") | |
echo "waiting for certificate to be initialized..." | |
sleep 10 | |
echo "printing out validation emails for $cert_arn:" | |
aws --region us-east-1 acm describe-certificate --certificate-arn $cert_arn | jq '.Certificate.DomainValidationOptions[0].ValidationEmails' | |
echo "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment