modify_snapshot_attribute
¶
modify_snapshot_attribute(
*,
config_overrides: Optional[EC2ClientConfig] = None,
attribute: Optional[SnapshotAttributeName] = None,
create_volume_permission: Optional[CreateVolumePermissionModifications] = None,
group_names: Optional[GroupNameStringList] = None,
operation_type: Optional[OperationType] = None,
snapshot_id: Optional[SnapshotId] = None,
user_ids: Optional[UserIdStringList] = None,
dry_run: Optional[Boolean] = None,
) -> None
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.
Parameters:
-
attribute(Optional[SnapshotAttributeName], default:None) –The snapshot attribute to modify. Only volume creation permissions can be modified.
-
create_volume_permission(Optional[CreateVolumePermissionModifications], default:None) –A JSON representation of the snapshot attribute modification.
-
group_names(Optional[GroupNameStringList], default:None) –The group to modify for the snapshot.
-
operation_type(Optional[OperationType], default:None) –The type of operation to perform to the attribute.
-
snapshot_id(Optional[SnapshotId], default:None) –The ID of the snapshot.
-
user_ids(Optional[UserIdStringList], default:None) –The account ID to modify for the snapshot.
-
dry_run(Optional[Boolean], default:None) –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.
Raises:
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To make a snapshot public
This example makes the snapshot snap-1234567890abcdef0 public.
>>> client.modify_snapshot_attribute(snapshot_id='snap-1234567890abcdef0', attribute='createVolumePermission', operation_type='add', group_names=['all'])
To modify a snapshot attribute
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.
>>> client.modify_snapshot_attribute(snapshot_id='snap-1234567890abcdef0', attribute='createVolumePermission', operation_type='remove', user_ids=['123456789012'])
Source code in docs_src/capo_ec2/_services/ec2.py
52362 52363 52364 52365 52366 52367 52368 52369 52370 52371 52372 52373 52374 52375 52376 52377 52378 52379 52380 52381 52382 52383 52384 52385 52386 52387 52388 52389 52390 52391 52392 52393 52394 52395 52396 52397 52398 52399 52400 52401 52402 52403 52404 52405 52406 52407 52408 52409 52410 52411 52412 52413 52414 52415 52416 52417 52418 52419 52420 52421 52422 52423 52424 52425 52426 52427 52428 52429 52430 52431 52432 52433 52434 52435 52436 52437 52438 52439 52440 52441 52442 52443 52444 | |