How to get owners ID and Image name from AWS Market Place

Updated: May 5, 2020

While coding for the AWS, we sometimes come across to use ownersID of images to launch an instance (e.g via terraform).

Unfortunately, it is not mentioned on AWS Marketplace with eye catching.


let’s say we want to launch an AWS instance for WordPress via terraform which based on the latest available Ubuntu 18.04 image.


To find the best image (AMI) for our task, we will check it on AWS Market Place for our requirement.

Go to "https://aws.amazon.com/marketplace"

In the search box, type the required distribution and application.

In out case, we will type, "wordpress" and "ubuntu".

In the next window, it will show number of result for your search. Select the required one.

Now, click on the name of image, in the next window, click on "continue to subscribe" button.

Now, you have to extract the "productid" from the URL.

You can use this image after accepting the "Terms and Conditions" of AWS Market Place, usually is cost extra $$ on usage. If you don't accept the Terms, your code will encounter an error

Now that we have the "productid", we can use the "aws cli" to help us find the rest info we need to create new instance.

Let's query the images associated with this product-id.

Open aws cli and run the below command:


 aws ec2 describe-images  --owners aws-marketplace --filters "Name=name,Values=*d9a5c6a8-c873-41d7-b9d7-6e15ae0addc3*" --output json | jq -r '.Images[] | "\(.OwnerId)\t\(.Name)"'

This will provide owner-id and Name value for this image.


679593333241    SupportedImages Wordpress on Ubuntu 18.04-d9a5c6a8-c873-41d7-b9d7-6e15ae0addc3-ami-068810bfbaecb87dc.4

Now we have "OwnerID" "Image name value" this will be required for our code.


16 views0 comments

Recent Posts

See All

TCP-Route.com

Pune, Maharashtra, India

©2020 by Khalid Waseem.