在使用筛选器与AWS Marketplace AMI时出现的EC2 describe-images问题。

0

【以下的问题经过翻译处理】 使用过滤器无法搜索市场 AMI;这很令人沮丧,因为我们使用产品代码找到最新的 AMI。您可以通过在控制台上启动实例时查找标准 AMI 来搜索:

➜  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"
        }
    ]
}

在使用 --image-id 参数时搜索市场 AMI :

➜   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"
        }
    ]
}

再使用 image-id 过滤器搜索相同的 AMI,则返回空值,如下:

➜ 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": []
}

这在前几天还可以正常使用,或者我认为是能够正常使用,但是在这中间可能是我做了一些更改,还是这个行为发生了变化?

profile picture
EXPERTE
gefragt vor 5 Monaten84 Aufrufe
1 Antwort
0

【以下的回答经过翻译处理】 该AMI已经过时:

"DeprecationTime": "2022-07-31T17:51:20.000Z"

可以参考链接:https://aws.amazon.com/about-aws/whats-new/2022/03/amazon-machine-images-public-visibility-two-years/

profile picture
EXPERTE
beantwortet vor 5 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen