I am attempting to copy an EC2 image for the purpose of encrypting it.
The command line I issue is:
$ aws ec2 copy-image --name encrypted-kafka-201707121432 \
--source-region ap-southeast-2 --encrypted --source-image-id ami-2a617249 \
--region ap-southeast-2
This leads to the following error being emitted:
An error occurred (InvalidRequest) when calling the CopyImage operation:
Images with EC2 BillingProduct codes cannot be copied to another AWS account.
I have looked around and I understand that this error is typically seen when copying Windows AMIs (e.g. here) and it is similar to this issue on SO (here).
However, this image is not from the Marketplace, and it is not a Windows AMI, and it does not have any ProductCodes in it:
$ aws ec2 describe-images --image-ids ami-2a617249 --region ap-southeast-2 \
--query '.Images[].ProductCodes'
[]
Compare this to another one that does:
$ aws ec2 describe-images --image-ids ami-00280263 --region ap-southeast-2 \
--query '.Images[].ProductCodes'
[
{
"ProductCodeType": "marketplace",
"ProductCodeId": "dsli9z1o9amfv5g2hsmdj1pph"
}
]
The image was baked using Packer.
I am out of ideas. Why is this happening - am I doing something wrong, or is this undocumented behaviour?