Menu
Amazon Elastic Compute Cloud
API Reference (API Version 2016-11-15)

ModifyImageAttribute

Modifies the specified attribute of the specified AMI. You can specify only one attribute at a time. You can use the Attribute parameter to specify the attribute or one of the following parameters: Description, LaunchPermission, or ProductCode.

AWS Marketplace product codes cannot be modified. Images with an AWS Marketplace product code cannot be made public.

To enable the SriovNetSupport enhanced networking attribute of an image, enable SriovNetSupport on an instance and create an AMI from the instance.

Request Parameters

The following parameters are for this specific action. For more information about required and optional parameters that are common to all actions, see Common Query Parameters.

Attribute

The name of the attribute to modify. The valid values are description, launchPermission, and productCodes.

Type: String

Required: No

Description

A new description for the AMI.

Type: AttributeValue object

Required: No

DryRun

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Type: Boolean

Required: No

ImageId

The ID of the AMI.

Type: String

Required: Yes

LaunchPermission

A new launch permission for the AMI.

Type: LaunchPermissionModifications object

Required: No

OperationType

The operation type. This parameter can be used only when the Attribute parameter is launchPermission.

Type: String

Valid Values: add | remove

Required: No

ProductCode.N

One or more DevPay product codes. After you add a product code to an AMI, it can't be removed.

Type: Array of strings

Required: No

UserGroup.N

One or more user groups. This parameter can be used only when the Attribute parameter is launchPermission.

Type: Array of strings

Required: No

UserId.N

One or more AWS account IDs. This parameter can be used only when the Attribute parameter is launchPermission.

Type: Array of strings

Required: No

Value

The value of the attribute being modified. This parameter can be used only when the Attribute parameter is description or productCodes.

Type: String

Required: No

Response Elements

The following elements are returned by the service.

requestId

The ID of the request.

Type: String

return

Is true if the request succeeds, and an error otherwise.

Type: Boolean

Errors

For information about the errors that are common to all actions, see Common Client Errors.

Examples

Example 1

This example makes the AMI public (for example, so any AWS account can use it).

Sample Request

https://ec2.amazonaws.com/?Action=ModifyImageAttribute
&ImageId=ami-61a54008
&LaunchPermission.Add.1.Group=all
&AUTHPARAMS

Sample Response

<ModifyImageAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
  <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> 
  <return>true</return>
</ModifyImageAttributeResponse>

Example 2

This example makes the AMI private (for example, so that only you as the owner can use it).

Sample Request

https://ec2.amazonaws.com/?Action=ModifyImageAttribute
&ImageId=ami-61a54008
&LaunchPermission.Remove.1.Group=all
&AUTHPARAMS

Example 3

This example grants launch permission to the AWS account with ID 111122223333.

Sample Request

https://ec2.amazonaws.com/?Action=ModifyImageAttribute
&ImageId=ami-61a54008
&LaunchPermission.Add.1.UserId=111122223333
&AUTHPARAMS

Example 4

This example adds the 774F4FF8 product code to the ami-61a54008 AMI.

Sample Request

https://ec2.amazonaws.com/?Action=ModifyImageAttribute
&ImageId=ami-61a54008
&ProductCode.1=774F4FF8
&AUTHPARAMS

Example 5

This example changes the description of the AMI to New Description.

Sample Request

https://ec2.amazonaws.com/?Action=ModifyImageAttribute
&ImageId=ami-61a54008
&Description.Value=New Description
&AUTHPARAMS

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: