How do I bulk copy AMI AWS account number permissi

2019-07-27 05:22发布

问题:

I have an AMI image which is private and via the Permissions tab I have made the image available to several dozen AWS account numbers.

I have a new AMI image that I would like to make available to the same AWS accounts as the original image.

I can cut and paste each account number into the Permissions tab dialog on the new AMI image... but that seems very tedious. Is there a way to bulk copy the AWS account number permissions set on one AMI image to another AMI image?

Thanks.

回答1:

You should be able to script this using the AWS CLI command aws ec2 modify-image-attribute

See some of the examples in the documentation. Specifically the example titled "To grant launch permission to an AWS account"