Snowcrash
Snowcrash

Reputation: 86367

AWS - finding a Linux AMI

How come when I do

aws ec2 describe-images --filters "Name=platform,Values=windows"

I get hundreds of results but when I do:

aws ec2 describe-images --filters "Name=platform,Values=linux"

I get:

{
    "Images": []
}

or

aws ec2 describe-images --filters "Name=platform,Values=ubuntu"
{
    "Images": []
}

Upvotes: 4

Views: 1746

Answers (3)

Stelios Psarras
Stelios Psarras

Reputation: 11

If you need to retrieve information for all the available Ubuntu images then you can do:

aws ec2 describe-images --filters "Name=name,Values=*ubuntu*"

It will return a very long list of results which you can further filter using any of the following filters: VirtualizationType, Name, Hypervisor, ImageId, State, BlockDeviceMappings, Architecture, ImageLocation, RootDeviceType, CreationDate, Public, ImageType. You can even specify the owner(s) of the AMI, an example:

aws ec2 describe-images --filters "Name=architecture,Values=x86_64" "Name=root-device-type,Values=ebs" "Name=virtualization-type,Values=hvm" "Name=name,Values=*ubuntu*xenial*" --owners=099720109477

Upvotes: 1

Udo Held
Udo Held

Reputation: 12548

As already noted by Khalid the platform tag seems only to be set and supported for windows.

You could search for the description instead:

aws ec2 describe-images --filters "Name=description,Values=*ubuntu*"
aws ec2 describe-images --filters "Name=description,Values=*linux*"

These gives lots of results....

If you are searching for official Amazon AMIs you could check:

aws ec2 describe-images --filters "Name=description,Values=*Linux*" "Name=owner-alias,Values=amazon"

Upvotes: 2

Khalid T.
Khalid T.

Reputation: 10567

Although this is not clearly stated by AWS on their website, but it seems that the platform filter in describe-images behaves the same way as describe-instances. It only accepts windows or empty.

platform - The platform. Use windows if you have Windows instances; otherwise, leave blank.

This reference explicitly states that the only valid value for the platform filter is windows. (Page 353)

Upvotes: 1

Related Questions