Skip to content

Instantly share code, notes, and snippets.

@PuKoren
Created January 10, 2015 14:20
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save PuKoren/3726654dfd033e302b8e to your computer and use it in GitHub Desktop.
Save PuKoren/3726654dfd033e302b8e 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