I seem to be unable to search for marketplace AMIs when using a filter; this is frustrating because we use the product code to find the most up to date AMI.
Searching for a standard AMI that you'd find if trying to launch an instance from the console:
➜ aws ec2 describe-images --filters Name="image-id",Values="ami-09e2d756e7d78558d" --debug | cat
2022-09-21 14:38:36,360 - MainThread - awscli.formatter - DEBUG - RequestId: f3bf3f72-eabe-46a2-bdad-151712069a87
{
"Images": [
{
"Architecture": "x86_64",
"CreationDate": "2022-08-17T23:46:17.000Z",
"ImageId": "ami-09e2d756e7d78558d",
"ImageLocation": "amazon/amzn2-ami-kernel-5.10-hvm-2.0.20220805.0-x86_64-gp2",
"ImageType": "machine",
"Public": true,
"OwnerId": "137112412989",
"PlatformDetails": "Linux/UNIX",
"UsageOperation": "RunInstances",
"State": "available",
"BlockDeviceMappings": [
{
"DeviceName": "/dev/xvda",
"Ebs": {
"DeleteOnTermination": true,
"SnapshotId": "snap-0b1e0b58f54fc89ef",
"VolumeSize": 8,
"VolumeType": "gp2",
"Encrypted": false
}
}
],
"Description": "Amazon Linux 2 Kernel 5.10 AMI 2.0.20220805.0 x86_64 HVM gp2",
"EnaSupport": true,
"Hypervisor": "xen",
"ImageOwnerAlias": "amazon",
"Name": "amzn2-ami-kernel-5.10-hvm-2.0.20220805.0-x86_64-gp2",
"RootDeviceName": "/dev/xvda",
"RootDeviceType": "ebs",
"SriovNetSupport": "simple",
"VirtualizationType": "hvm",
"DeprecationTime": "2024-08-17T23:46:17.000Z"
}
]
}
Searching for a marketplace AMI using the --image-id
param:
➜ aws ec2 describe-images --image-ids ami-0e1415fedc1664f51 --debug| cat
2022-09-21 14:39:14,069 - MainThread - awscli.formatter - DEBUG - RequestId: 3d52e935-1d74-48aa-b205-6dad06d23eb6
{
"Images": [
{
"Architecture": "x86_64",
"CreationDate": "2020-07-31T17:51:20.000Z",
"ImageId": "ami-0e1415fedc1664f51",
"ImageLocation": "aws-marketplace/OpenVPN Access Server Community Image-fe8020db-5343-4c43-9e65-5ed4a825c931-ami-06585f7cf2fb8855c.4",
"ImageType": "machine",
"Public": true,
"OwnerId": "679593333241",
"PlatformDetails": "Linux/UNIX",
"UsageOperation": "RunInstances",
"ProductCodes": [
{
"ProductCodeId": "f2ew2wrz425a1jagnifd02u5t",
"ProductCodeType": "marketplace"
}
],
"State": "available",
"BlockDeviceMappings": [
{
"DeviceName": "/dev/sda1",
"Ebs": {
"DeleteOnTermination": true,
"SnapshotId": "snap-0bb5570e9d1eb75ea",
"VolumeSize": 8,
"VolumeType": "gp2",
"Encrypted": false
}
},
{
"DeviceName": "/dev/sdb",
"VirtualName": "ephemeral0"
},
{
"DeviceName": "/dev/sdc",
"VirtualName": "ephemeral1"
}
],
"Description": "OpenVPN Access Server 2.8.3 publisher image from https://www.openvpn.net/.",
"EnaSupport": true,
"Hypervisor": "xen",
"ImageOwnerAlias": "aws-marketplace",
"Name": "OpenVPN Access Server Community Image-fe8020db-5343-4c43-9e65-5ed4a825c931-ami-06585f7cf2fb8855c.4",
"RootDeviceName": "/dev/sda1",
"RootDeviceType": "ebs",
"SriovNetSupport": "simple",
"VirtualizationType": "hvm",
"DeprecationTime": "2022-07-31T17:51:20.000Z"
}
]
}
Searching for the same AMI; using the image-id
filter (that worked for the first request):
➜ aws ec2 describe-images --filters Name="image-id",Values="ami-0e1415fedc1664f51" --debug | cat
2022-09-21 14:39:41,422 - MainThread - awscli.formatter - DEBUG - RequestId: 1de1f1a6-76cf-4664-bde5-1f8a3f061815
{
"Images": []
}
This was working the other day; or so I believe... am I doing something daft or has this behavior changed?