modify_snapshot_attribute
(**kwargs)¶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 Elastic Compute Cloud User Guide .
See also: AWS API Documentation
Request Syntax
response = client.modify_snapshot_attribute(
Attribute='productCodes'|'createVolumePermission',
CreateVolumePermission={
'Add': [
{
'Group': 'all',
'UserId': 'string'
},
],
'Remove': [
{
'Group': 'all',
'UserId': 'string'
},
]
},
GroupNames=[
'string',
],
OperationType='add'|'remove',
SnapshotId='string',
UserIds=[
'string',
],
DryRun=True|False
)
A JSON representation of the snapshot attribute modification.
Adds the specified Amazon Web Services account ID or group to the list.
Describes the user or group to be added or removed from the list of create volume permissions for a volume.
The group to be added or removed. The possible value is all
.
The ID of the Amazon Web Services account to be added or removed.
Removes the specified Amazon Web Services account ID or group from the list.
Describes the user or group to be added or removed from the list of create volume permissions for a volume.
The group to be added or removed. The possible value is all
.
The ID of the Amazon Web Services account to be added or removed.
The group to modify for the snapshot.
[REQUIRED]
The ID of the snapshot.
The account ID to modify for the snapshot.
DryRunOperation
. Otherwise, it is UnauthorizedOperation
.None
Examples
This example modifies snapshot snap-1234567890abcdef0
to remove the create volume permission for a user with the account ID 123456789012
. If the command succeeds, no output is returned.
response = client.modify_snapshot_attribute(
Attribute='createVolumePermission',
OperationType='remove',
SnapshotId='snap-1234567890abcdef0',
UserIds=[
'123456789012',
],
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
This example makes the snapshot snap-1234567890abcdef0
public.
response = client.modify_snapshot_attribute(
Attribute='createVolumePermission',
GroupNames=[
'all',
],
OperationType='add',
SnapshotId='snap-1234567890abcdef0',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}