Search code examples
amazon-web-servicespermissionsamazon-ami

How do I bulk copy AMI AWS account number permissions from one AMI image to another?


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.


Solution

  • 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"