"export-image" returns "InvalidParameter" "The image ID (ami-03af6a70ccd8cb578) provided does not exist"

0

Probably a n00b question, but what am I doing wrong, that for a standard Amazon Linux 2 AMI ami-03af6a70ccd8cb578 ("amzn2-ami-kernel-5.10-hvm-2.0.20211201.0-x86_64-gp2") aws ec2 describe-images --image-ids ami-03af6a70ccd8cb578 works fine and shows:

{
    "Images": [
        {
            "Architecture": "x86_64",
            "CreationDate": "2021-12-01T20:06:29.000Z",
            "ImageId": "ami-03af6a70ccd8cb578",
            "ImageLocation": "amazon/amzn2-ami-kernel-5.10-hvm-2.0.20211201.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-0d3c07fe7b24df1b8",
                        "VolumeSize": 8,
                        "VolumeType": "gp2",
                        "Encrypted": false
                    }
                }
            ],
            "Description": "Amazon Linux 2 Kernel 5.10 AMI 2.0.20211201.0 x86_64 HVM gp2",
            "EnaSupport": true,
            "Hypervisor": "xen",
            "ImageOwnerAlias": "amazon",
            "Name": "amzn2-ami-kernel-5.10-hvm-2.0.20211201.0-x86_64-gp2",
            "RootDeviceName": "/dev/xvda",
            "RootDeviceType": "ebs",
            "SriovNetSupport": "simple",
            "VirtualizationType": "hvm"
        }
    ]
}

But yet: aws ec2 export-image --image-id 'ami-03af6a70ccd8cb578' --disk-image-format VMDK --s3-export-location S3Bucket=XXX,S3Prefix=exports/ Throws:

An error occurred (InvalidParameter) when calling the ExportImage operation: The image ID (ami-03af6a70ccd8cb578) provided does not exist. Please make sure the ID is correct.
질문됨 2년 전1182회 조회
1개 답변
0
수락된 답변

There are several limitations for export image that can result in an error. These are documented here: https://docs.aws.amazon.com/vm-import/latest/userguide/vmexport_image.html#limits-image-export

The one that applies in this case is "You can't export an image from Amazon EC2 if you've shared it from another AWS account". If you're using the standard Amazon Linux 2 AMI, that exists in another account, managed by AWS. You should be able to copy the AMI into your own account, then export it using that AMI ID, as long as none of the other limitations apply.

AWS
답변함 2년 전
  • That was it indeed! The documentation didn't make it obvious that "shared from another AWS account" also applied to public Amazon-published AMIs, and the "InvalidParameter" "image ID does not exist" is a misleading error code IMHO. But thank you for clarifying: I'm able to export the copied AMI after waiting a while for the copied AMI to become "Available" from "Pending," which BTW took a while even after the contained snapshot was copied over successfully.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠