Last active
August 4, 2020 08:54
-
-
Save srkiNZ84/b4b5fd85dcb2787cd27d0f8d92de4155 to your computer and use it in GitHub Desktop.
Bash script to check whether the certificate you've got locally is already in AWS Certificate Manager or not (based on md5sum and tags)
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 | |
CURRENT_CERT_MD5SUM=af375610c480018271caa1b624c838b3 | |
for acmCertificate in $(aws acm list-certificates | jq -r .CertificateSummaryList[].CertificateArn) | |
do | |
echo "Cert ARN is $acmCertificate" | |
ACM_CERT_MD5SUM=$(aws acm list-tags-for-certificate --certificate-arn $acmCertificate | jq -r '.Tags[] | select(.Key | contains("Md5SumCert")) | .Value') | |
if [[ "$CURRENT_CERT_MD5SUM" == "$ACM_CERT_MD5SUM" ]] | |
then | |
echo "Certificate with ARN $acmCertificate already exists with this certificate data" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment