Skip to content

Instantly share code, notes, and snippets.

@toddwprice
Forked from PuKoren/digicert_to_aws.sh
Created December 15, 2015 23:50
Show Gist options
  • Save toddwprice/65e1956544eec90218c7 to your computer and use it in GitHub Desktop.
Save toddwprice/65e1956544eec90218c7 to your computer and use it in GitHub Desktop.
Upload Digicert certificate to Amazon Web Services (AWS)
#!/bin/sh
# $1: certificate name on AWS
# $2: certificate file (crt)
# $3: private key file (pem)
# $4: DigicertCA2 path
# $5: TrustedRoot path
# Download certificates on Digicert (Other formats > Individual crt files with a .cer extension)
# Generate intermediate cert for AWS (not an option, many browsers requires it it). Intermediate is concatenation of CA and Root certs
(openssl x509 -inform PEM -in $4; openssl x509 -inform PEM -in $5) > Intermediate.cer
# Upload to AWS (If you don't have awscli, see http://docs.aws.amazon.com/cli/latest/userguide/tutorial-ec2-ubuntu.html)
aws iam upload-server-certificate --server-certificate-name '$1' --certificate-body file://$2 --private-key file://$3 --certificate-chain file://Intermediate.cer
#######
# Without params for history purpose
#######
# (openssl x509 -inform PEM -in DigiCertCA2.cer; openssl x509 -inform PEM -in TrustedRoot.cer) > Intermediate.cer
# aws iam upload-server-certificate --server-certificate-name 'CERT_NAME_ON_AWS' --certificate-body file://certificate.cer -- private-key file://private.pem --certificate-chain file://Intermediate.cer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment