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.
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.