Created
December 17, 2015 10:21
-
-
Save theist/a6fb67a1c514eb051458 to your computer and use it in GitHub Desktop.
This creates a selfsigned certificate/key pair an upload it to AWS iam for use in ELBs and the like
This file contains hidden or 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 | |
DOMAIN=$1 | |
openssl req -new -subj '/CN=${DOMAIN}/O=ACME./C=ES' -newkey rsa:2048 -days 365 -nodes -x509 -keyout ${DOMAIN}.key -out ${DOMAIN}.crt | |
if aws iam list-server-certificates --query "ServerCertificateMetadataList[*].ServerCertificateName" --output text | grep -q ${DOMAIN} ; then | |
aws iam delete-server-certificate --server-certificate-name ${DOMAIN} | |
fi | |
aws iam upload-server-certificate --server-certificate-name ${DOMAIN} --certificate-body file://${DOMAIN}.crt --private-key file://${DOMAIN}.key --query "ServerCertificateMetadata.[ServerCertificateName,Expiration,Arn]" --output text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment