snapshot_attributes
Creates, updates, deletes, gets or lists a snapshot_attributes resource.
Overview
| Name | snapshot_attributes |
| Type | Resource |
| Id | aws.ec2.snapshot_attributes |
Fields
The following fields are returned by SELECT queries:
- describe_snapshot_attribute
| Name | Datatype | Description |
|---|---|---|
product_code_id | string | The product code. |
product_code_type | string | The type of product code. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_snapshot_attribute | select | Attribute, SnapshotId, region | DryRun | 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. |
modify_snapshot_attribute | update | SnapshotId, region | Attribute, CreateVolumePermission, UserGroup, OperationType, UserId, DryRun | 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
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.
| Name | Datatype | Description |
|---|---|---|
Attribute | string | The snapshot attribute you would like to view. |
SnapshotId | string | The ID of the snapshot. |
region | string | AWS region (default: us-east-1) |
Attribute | string | The snapshot attribute to modify. Only volume creation permissions can be modified. |
CreateVolumePermission | object | A JSON representation of the snapshot attribute modification. |
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. |
OperationType | string | The type of operation to perform to the attribute. |
UserGroup | array | The group to modify for the snapshot. |
UserId | array | The account ID to modify for the snapshot. |
SELECT examples
- describe_snapshot_attribute
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
- modify_snapshot_attribute
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}};