Skip to main content

snapshot_attributes

Creates, updates, deletes, gets or lists a snapshot_attributes resource.

Overview

Namesnapshot_attributes
TypeResource
Idaws.ec2.snapshot_attributes

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
product_code_idstringThe product code.
product_code_typestringThe type of product code.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_snapshot_attributeselectAttribute, SnapshotId, regionDryRunDescribes the specified attribute of the specified snapshot. You can specify only one attribute at a time. For more information about EBS snapshots, see Amazon EBS snapshots in the Amazon EBS User Guide.
modify_snapshot_attributeupdateSnapshotId, regionAttribute, CreateVolumePermission, UserGroup, OperationType, UserId, DryRunAdds 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

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
AttributestringThe snapshot attribute you would like to view.
SnapshotIdstringThe ID of the snapshot.
regionstringAWS region (default: us-east-1)
AttributestringThe snapshot attribute to modify. Only volume creation permissions can be modified.
CreateVolumePermissionobjectA JSON representation of the snapshot attribute modification.
DryRunbooleanChecks 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.
OperationTypestringThe type of operation to perform to the attribute.
UserGrouparrayThe group to modify for the snapshot.
UserIdarrayThe account ID to modify for the snapshot.

SELECT examples

Describes the specified attribute of the specified snapshot. You can specify only one attribute at a time. For more information about EBS snapshots, see Amazon EBS snapshots in the Amazon EBS User Guide.

SELECT
product_code_id,
product_code_type
FROM aws.ec2.snapshot_attributes
WHERE Attribute = '{{ Attribute }}' -- required
AND SnapshotId = '{{ SnapshotId }}' -- required
AND region = '{{ region }}' -- required
AND DryRun = '{{ DryRun }}'
;

UPDATE examples

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.

UPDATE aws.ec2.snapshot_attributes
SET
-- No updatable properties
WHERE
SnapshotId = '{{ SnapshotId }}' --required
AND region = '{{ region }}' --required
AND Attribute = '{{ Attribute}}'
AND CreateVolumePermission = '{{ CreateVolumePermission}}'
AND UserGroup = '{{ UserGroup}}'
AND OperationType = '{{ OperationType}}'
AND UserId = '{{ UserId}}'
AND DryRun = {{ DryRun}};