-
-
Save bashtoni/995c0683bb18fd19eaefdc296a9401d8 to your computer and use it in GitHub Desktop.
aws acm us-east-1 list-certificates --query CertificateSummaryList[].[CertificateArn,DomainName] \ | |
--output text | grep example.com | cut -f1 |
Thanks for the gist!
Here's a version with the JMESPath query that adds --region
and --profile
flags.
aws acm list-certificates --query "CertificateSummaryList[?DomainName=='example.com'].CertificateArn" --output text --region us-east-1 --profile default
In terms of writing a script I think you almost certainly want to specify the --region
because this is so important for ACM certificates. For example, all CloudFront certificates must be in us-east-1, meanwhile you might have other resources in other regions.
If you omit the --region
AWS will fallback to default and this could vary between users / AWS environments.
Thanks for the pure JMESPath verison!
In terms of writing a script I think you almost certainly want to specify the
--region
because this is so important for ACM certificates. For example, all CloudFront certificates must be in us-east-1, meanwhile you might have other resources in other regions.If you omit the
--region
AWS will fallback to default and this could vary between users / AWS environments.
I'd suggest that you use the AWS_REGION
and AWS_PROFILE
variables to handle this - it allows the same script to be used across multiple regions and accounts.
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html
Nicely done