Snapshot / Action / modify_attribute

modify_attribute#

EC2.Snapshot.modify_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 EBS User Guide.

See also: AWS API Documentation

Request Syntax

response = snapshot.modify_attribute(
    Attribute='productCodes'|'createVolumePermission',
    CreateVolumePermission={
        'Add': [
            {
                'Group': 'all',
                'UserId': 'string'
            },
        ],
        'Remove': [
            {
                'Group': 'all',
                'UserId': 'string'
            },
        ]
    },
    GroupNames=[
        'string',
    ],
    OperationType='add'|'remove',
    UserIds=[
        'string',
    ],
    DryRun=True|False
)
Parameters:
  • Attribute (string) – The snapshot attribute to modify. Only volume creation permissions can be modified.

  • CreateVolumePermission (dict) –

    A JSON representation of the snapshot attribute modification.

    • Add (list) –

      Adds the specified Amazon Web Services account ID or group to the list.

      • (dict) –

        Describes the user or group to be added or removed from the list of create volume permissions for a volume.

        • Group (string) –

          The group to be added or removed. The possible value is all.

        • UserId (string) –

          The ID of the Amazon Web Services account to be added or removed.

    • Remove (list) –

      Removes the specified Amazon Web Services account ID or group from the list.

      • (dict) –

        Describes the user or group to be added or removed from the list of create volume permissions for a volume.

        • Group (string) –

          The group to be added or removed. The possible value is all.

        • UserId (string) –

          The ID of the Amazon Web Services account to be added or removed.

  • GroupNames (list) –

    The group to modify for the snapshot.

    • (string) –

  • OperationType (string) – The type of operation to perform to the attribute.

  • UserIds (list) –

    The account ID to modify for the snapshot.

    • (string) –

  • DryRun (boolean) – 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.

Returns:

None