How can we change an AMI's permission to add more AWS accounts using python's boto module ?
You can use the modify_image_attribute method of the boto.ec2
module to modify this and other attributes associated with an image.
You can add additional authorized users like this:
import boto.ec2
ec2 = boto.ec2.connect_to_region('<your region>')
ec2.modify_image_attribute('ami-12345678', operation='add', attribute='launchPermission', user_ids=['user_id_1', 'user_id_2'])
Similarly, you could add authorize groups using the attribute='launchPermission'
and the group values in the parameter group_ids
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With