CentOS publishes their AMI product codes to their wiki. The wiki provides the following information for the latest CentOS 7 AMI:
- Owner:
aws-marketplace - Product Code:
aw0evgkw8e5c1q413zgy5pjce
Using this information, we can query describe-images with the AWS CLI:
Example:
aws ec2 describe-images \
--owners 'aws-marketplace' \
--filters 'Name=product-code,Values=aw0evgkw8e5c1q413zgy5pjce' \
--query 'sort_by(Images, &CreationDate)[-1].[ImageId]' \
--output 'text'
Output:
ami-6d1c2007
This query returns a single AMI ID, selected by sorting the collection by creation date and then selecting the last (most recent) element in the collection.
Per the CentOS wiki, multiple AMI ids may be associated with a product key, so while this query would currently only return a single AMI because only one matching this product currently exists... in the future if a new AMI is created for this product code for any reason this query will return it instead.
CentOS publishes their AMI product codes to their wiki. The wiki provides the following information for the latest CentOS 7 AMI:
- Owner:
aws-marketplace - Product Code:
aw0evgkw8e5c1q413zgy5pjce
Using this information, we can query describe-images with the AWS CLI:
Example:
aws ec2 describe-images \
--owners 'aws-marketplace' \
--filters 'Name=product-code,Values=aw0evgkw8e5c1q413zgy5pjce' \
--query 'sort_by(Images, &CreationDate)[-1].[ImageId]' \
--output 'text'
Output:
ami-6d1c2007
This query returns a single AMI ID, selected by sorting the collection by creation date and then selecting the last (most recent) element in the collection.
Per the CentOS wiki, multiple AMI ids may be associated with a product key, so while this query would currently only return a single AMI because only one matching this product currently exists... in the future if a new AMI is created for this product code for any reason this query will return it instead.
Check in this page
or
AWS has been changing the “aws marketplace” UI. Now (2022) We get the ami id in the “configure this software” Page in the AWS Marketplace itself.
Steps:
- Search and locate the image. Click on the image.
- On the top right, click “continue to subscribe”
- On the next window, click on “Continue to configuration”
- On the next window, Find the Ami ID located. We can change software versions to get different ami Ids.
amazon web services - How am I supposed to get the owner id of an aws market place ami? - Stack Overflow
How to know the version of the AMI used by a subscriber?
AWS Marketplace AMI ARN for Terraform?
How to find an AMI ID.
Hello everyone, I am trying to figure out how I can get an AMI id for Kali Linux from amazon market place. This is so I can launch an Ec2 instance. Any help would be greatly appreciated.
I need the Id so I can deploy the instance directly from Git.
You don't necessarily need the owner ID but it is obviously a good idea to include to ensure you are getting the AMI you expect.
Given that you know the trusted owner up-front, the simple way to find the owner ID is to look in the AMIs table in the AWS console.
From the AWS console, navigate to EC2 > Images > AMIs. Select the "Public Images" filter from the dropdown on the left of the search box. You can then search for any AMI you want, and the Owner value is shown in the table:

If you'd like the use the AWS SDK; the easiest way to go about this is something like the following:
aws ec2 describe-images --image-ids ami-0def3275 --region us-west-2
Of course, replace the region and AMI ID as appropriate.
If you'd like to use jq to then parse this; you could something like:
aws ec2 describe-images --image-ids ami-0def3275 --region us-west-2 | jq -r .Images[0].OwnerId
Trying to use a marketplace AMI for the parent_image template since I can't find the ARN but for parent_image it says the ARN is required.. is there a way to sub something that just has an AMI?
parent_image = "arn:${data.aws_partition.current.partition}:imagebuilder:${data.aws_region.current.name}:aws:image/amazon-linux-2-x86/x.x.x"