英文:
how to copy custom AMI from one AWS account to another
问题
我已经使用Packer创建了自定义AMI,并保存在一个AWS账户中,现在我想将相同的AMI复制到另一个AWS账户中。
可以有人帮忙实现这个吗?
我已经尝试过以下命令:
aws ec2 copy-image --name "${AMI_Name}" --source-image-id "${AMI_ID}" --source-region "us-west-2" --copy-image-tags
但我感到困惑,因为我没有提供目标信息。
英文:
I have created custom AMI using packer and saved into one AWS account, now I want to copy same AMI into another AWS account.
Can anyone help here to achieve this?
I have tried
aws ec2 copy-image --name "${AMI_Name}" --source-image-id "${AMI_ID}" --source-region "us-west-2" --copy-image-tags
but I am confused as I didn't provide the destination information
答案1
得分: 1
copy-image命令不会跨帐户复制AMI,它只会在同一帐户内不同区域之间复制。
要在不同帐户中使用AMI,您需要通过UI中的“编辑AMI权限”与另一个帐户共享它,并添加要与之共享AMI的帐户ID,或者使用以下命令:
aws ec2 modify-image-attribute
--image-id <<ami_id>>
--launch-permission "Add=[{UserId=<<remote_account_id>>}]"
英文:
copy-image command does not copy ami's across accounts, it does across regions within same account.
In order to use an ami in different account, you need to share it with another account by edit ami permissions
from the UI and adding the account id that you want to share the ami with, or instead use the following command
> aws ec2 modify-image-attribute
--image-id <<ami_id>>
--launch-permission "Add=[{UserId=<<remote_account_id>>}]"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论