Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
install ssl cert on aws, including creating intermediate for a complete chain
#!/bin/bash
# unofficial bash strict mode
set -euo pipefail
IFS=$'\n\t'
# Run script from dir with both certificate files and the private key
# certificate name on AWS
NAME=$1
# certificate file (crt)
CRT=${2:-$NAME.crt}
# private key file (pem)
KEY=${3:-$NAME.key}
# DigicertCA2 path
CA=${4:-DigiCertCA.crt}
# TrustedRoot path
TR=${5:-TrustedRoot.crt}
# Download certificates on Digicert (Other formats > Individual crt files with
# a .cer extension)
# Generate intermediate cert - WSO2 Api Manager requires it. Intermediate is
# concatenation of CA and Root certs.
(openssl x509 -inform PEM -in $CA; openssl x509 -inform PEM -in $TR) > Intermediate.cer
# Upload to AWS with awscli
aws iam upload-server-certificate \
--server-certificate-name $NAME \
--certificate-body file://$CRT \
--private-key file://$KEY \
--certificate-chain file://Intermediate.cer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.