How do I query in SM Parameter Store AMI Alias for a specific version of Amazon ECS-Optimized Amazon Linux 2 AMI


I am trying to query the AMI by lookup up the AMI Alias in SM Parameter Store for a specific version of Amazon ECS-Optimized Amazon Linux 2 AMI. The AMI Alias listed on Marketplace ( is Ami Alias: /aws/service/marketplace/prod-phaazl5qm6pka/2.0.20220121

When I query Name: equals: /aws/service/marketplace/prod-phaazl5qm6pka/2.0.20220121 I get "You do not have any parameters in this region."

I am able to query the "latest" version of the AMI Alias with a query Name: equals: /aws/service/marketplace/prod-phaazl5qm6pka/latest and get back exactly on result that has a string value with the expected AMI (currently ami-0e4efed85dffc2b28 for us-east-2).

I want to create some automation that uses the AMI Alias for specific version, and not "latest" and be able to lookup the AMI by region. What am I doing wrong in my query? Or am I maybe missing some permissions or something somewhere?

1 Answer

According to the docs, the /latest is the only public AMI parameters. You can always use the CLI:

aws ec2 describe-images --filters 'Name=name,Values=amzn2-ami-ecs-hvm-2.0.20220121-x86_64-ebs' Name=owner-alias,Values=amazon --query Images[*].ImageId --output text --region us-east-2
profile pictureAWS
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions