ec2-modify-image-attribute

ec2-modify-image-attribute ami_id -l (-a item_value | -r item_value)

ec2-modify-image-attribute ami_id -p product_code [-p product_code ...]

Modifies an attribute for the specified AMI.

Attribute NameTypeDescription

launchPermission

List

Controls who has permission to launch the AMI. You can grant launch permissions by adding user IDs or make the AMI public by adding the all group. To learn more about sharing AMIs see Sharing AMIs.

[Note]Note

If another user launches your AMI there is no mechanism to prevent that user from rebundling the image and registering it as a new AMI.

productCodes

List

Associates a product code with an AMI. This allows a developer to charge a user for using the AMI.

[Note]Note

The user must be signed up for the product before they can launch the AMI.

The product code attribute is a write-once attribute. After a product code is set for an AMI it can not be altered or removed. AMIs are limited to one product code.

OptionDescriptionRequired

-l

Modifies the launchPermission property.

Example: -l

Yes

-a item_value | -r item_value

Adds or removes an attribute item. The type of the item is inferred from the item value. For launchPermission there are two item types:

  • group: The only group currently supported is the all group. Adding this group sets public launch permissions for the AMI.

  • userId: The user ID is an AWS account ID, without dashes. Adding user IDs grants explicit launch permissions for the AMI.

Example: -a all

Yes

-p product_code

Sets the productCodes property.

Example: -p 774F4FF8

Yes

Amazon EC2 returns a table that contains the following information:

Amazon EC2 displays errors on stderr.

The following example modifies launch permission attributes for the ami-2bb65342 AMI:

$ ec2-modify-image-attribute ami-2bb65342 -l -a 495219933132
launchPermission ami-2bb65342 ADD userId 495219933132

The following example adds the 774F4FF8 product code to the ami-2bb65342 AMI:

$ ec2-modify-image-attribute ami-2bb65342 -p 774F4FF8
productCodes ami-2bb65342     productCode 774F4FF8