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
or LaunchPermission
.
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.
Valid values:
description
|launchPermission
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 isUnauthorizedOperation
.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 islaunchPermission
.Type: String
Valid Values:
add | remove
Required: No
- OrganizationalUnitArn.N
-
The Amazon Resource Name (ARN) of an organizational unit (OU). This parameter can be used only when the
Attribute
parameter islaunchPermission
.Type: Array of strings
Required: No
- OrganizationArn.N
-
The Amazon Resource Name (ARN) of an organization. This parameter can be used only when the
Attribute
parameter islaunchPermission
.Type: Array of strings
Required: No
- ProductCode.N
-
Not supported.
Type: Array of strings
Required: No
- UserGroup.N
-
The user groups. This parameter can be used only when the
Attribute
parameter islaunchPermission
.Type: Array of strings
Required: No
- UserId.N
-
The AWS account IDs. This parameter can be used only when the
Attribute
parameter islaunchPermission
.Type: Array of strings
Required: No
- Value
-
The value of the attribute being modified. This parameter can be used only when the
Attribute
parameter isdescription
.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 error codes.
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: