ModifySnapshotAttribute - Amazon Elastic Compute Cloud
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

ModifySnapshotAttribute

Adds or removes permission settings for the specified snapshot. You may add or remove specified Amazon Web Services account IDs from a snapshot's list of create volume permissions, but you cannot do both in a single operation. If you need to both add and remove account IDs for a snapshot, you must use multiple operations. You can make up to 500 modifications to a snapshot in a single operation.

Encrypted snapshots and snapshots with Amazon Web Services Marketplace product codes cannot be made public. Snapshots encrypted with your default KMS key cannot be shared with other accounts.

For more information about modifying snapshot permissions, see Share a snapshot in the Amazon EBS User Guide.

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 snapshot attribute to modify. Only volume creation permissions can be modified.

Type: String

Valid Values: productCodes | createVolumePermission

Required: No

CreateVolumePermission

A JSON representation of the snapshot attribute modification.

Type: CreateVolumePermissionModifications 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

OperationType

The type of operation to perform to the attribute.

Type: String

Valid Values: add | remove

Required: No

SnapshotId

The ID of the snapshot.

Type: String

Required: Yes

UserGroup.N

The group to modify for the snapshot.

Type: Array of strings

Required: No

UserId.N

The account ID to modify for the snapshot.

Type: Array of strings

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

This example makes the snap-1234567890abcdef0 snapshot public, and gives the account with ID 111122223333 permission to create volumes from the snapshot.

Sample Request

https://ec2.amazonaws.com/?Action=ModifySnapshotAttribute &SnapshotId=snap-1234567890abcdef0 &CreateVolumePermission.Add.1.UserId=111122223333 &CreateVolumePermission.Add.1.Group=all &AUTHPARAMS

Sample Response

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

Example

This example makes the snap-1234567890abcdef0 snapshot public, and removes the account with ID 111122223333 from the list of users with permission to create volumes from the snapshot.

Sample Request

https://ec2.amazonaws.com/?Action=ModifySnapshotAttribute &SnapshotId=snap-1234567890abcdef0 &CreateVolumePermission.Remove.1.UserId=111122223333 &CreateVolumePermission.Add.1.Group=all &AUTHPARAMS

Sample Response

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

See Also

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