-
-
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 mate
I'm surprised that the cli doesn't have built in to filter by domain name, thanks.
Perfect
This is perfect. Thank you.
One problem I see is, if there is domain with prefix, then it will provide those too.
for ex:
if we want to get ARN for example.com but there is one separate SSL for uat.example.com domain, then this command giving both of them.
Using AWS query
aws acm list-certificates --query "CertificateSummaryList[?DomainName=='example.com'].CertificateArn" --output text
Using AWS query
aws acm list-certificates --query "CertificateSummaryList[?DomainName=='example.com'].CertificateArn" --output text
perfect. thanks 👍
That's exactly what I was looking for although I'm surprised there isn't a CLI switch option built directly into the aws acm
command to get by domain name. Thanks @DimitrijeManic
was looking for this, thanks mate!
Love that AWS query. ❤️ Thanks!
Im getting Bad jmespath expression: Unknown token '-': error after command execution , can please guide me
Nicely done
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
cool!