【发布时间】:2017-07-12 08:33:05
【问题描述】:
我正在尝试复制 EC2 映像以对其进行加密。
我发出的命令行是:
$ aws ec2 copy-image --name encrypted-kafka-201707121432 \
--source-region ap-southeast-2 --encrypted --source-image-id ami-2a617249 \
--region ap-southeast-2
这会导致发出以下错误:
An error occurred (InvalidRequest) when calling the CopyImage operation:
Images with EC2 BillingProduct codes cannot be copied to another AWS account.
我环顾四周,了解到在复制 Windows AMI 时通常会出现此错误(例如 here),它与 SO (here) 上的此问题类似。
但是,此图像不是来自 Marketplace,也不是 Windows AMI,并且其中没有任何 ProductCode:
$ aws ec2 describe-images --image-ids ami-2a617249 --region ap-southeast-2 \
--query '.Images[].ProductCodes'
[]
将此与另一个比较:
$ aws ec2 describe-images --image-ids ami-00280263 --region ap-southeast-2 \
--query '.Images[].ProductCodes'
[
{
"ProductCodeType": "marketplace",
"ProductCodeId": "dsli9z1o9amfv5g2hsmdj1pph"
}
]
图像是使用 Packer 烘焙的。
我没有想法。为什么会发生这种情况 - 我做错了什么,还是这种无证行为?
【问题讨论】:
-
实例是从 Marketplace 实例的 AMI 生成的,还是以任何方式与 Marketplace 实例相关联?另见serverfault.com/questions/775946/… 和blog.open-tribute.org/2017/04/18/ami-copy-failed-billingproduct
-
据我所知,除非我被误导,否则不会。我想要排除这种情况,我需要自己完全完成所有上游 AMI 烘焙,还是有测试方法?
-
最终答案是“是”。完整的解释如下。
标签: amazon-web-services packer