"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.
asked 2 years ago1166 views
1 Answer
0
Accepted Answer

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
answered 2 years ago
  • 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.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions