snapshot_blocks
Creates, updates, deletes, gets or lists a snapshot_blocks resource.
Overview
| Name | snapshot_blocks |
| Type | Resource |
| Id | aws.ebs.snapshot_blocks |
Fields
The following fields are returned by SELECT queries:
- get_snapshot_block
- list_snapshot_blocks
| Name | Datatype | Description |
|---|---|---|
block_data | string (byte) | The data content of the block. |
checksum | string | The checksum generated for the block, which is Base64 encoded. (pattern: <code>^[A-Za-z0-9+/=]+$</code>) |
checksum_algorithm | string | The algorithm used to generate the checksum for the block, such as SHA256. (SHA256) (pattern: <code>^[A-Za-z0-9]+$</code>) |
data_length | integer | The size of the data in the block. |
| Name | Datatype | Description |
|---|---|---|
block_size | integer | The size of the blocks in the snapshot, in bytes. |
blocks | array | An array of objects containing information about the blocks. |
expiry_time | string (date-time) | The time when the BlockToken expires. |
next_token | string | The token to use to retrieve the next page of results. This value is null when there are no more results to return. (pattern: <code>^[A-Za-z0-9+/=]+$</code>) |
volume_size | integer (int64) | The size of the volume in GB. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_snapshot_block | select | snapshot_id, block_index, blockToken, region | Returns the data in a block in an Amazon Elastic Block Store snapshot. You should always retry requests that receive server (5xx) error responses, and ThrottlingException and RequestThrottledException client error responses. For more information see Error retries in the Amazon Elastic Compute Cloud User Guide. | |
list_snapshot_blocks | select | snapshot_id, region | pageToken, maxResults, startingBlockIndex | Returns information about the blocks in an Amazon Elastic Block Store snapshot. You should always retry requests that receive server (5xx) error responses, and ThrottlingException and RequestThrottledException client error responses. For more information see Error retries in the Amazon Elastic Compute Cloud User Guide. |
put_snapshot_block | replace | snapshot_id, block_index, x-amz-Data-Length, x-amz-Checksum, x-amz-Checksum-Algorithm, region, BlockData | x-amz-Progress | Writes a block of data to a snapshot. If the specified block contains data, the existing data is overwritten. The target snapshot must be in the pending state. Data written to a snapshot must be aligned with 512-KiB sectors. You should always retry requests that receive server (5xx) error responses, and ThrottlingException and RequestThrottledException client error responses. For more information see Error retries in the Amazon Elastic Compute Cloud 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 |
|---|---|---|
blockToken | string | The block token of the block from which to get data. You can obtain the BlockToken by running the ListChangedBlocks or ListSnapshotBlocks operations. |
block_index | integer | The block index of the block in which to write the data. A block index is a logical index in units of 512 KiB blocks. To identify the block index, divide the logical offset of the data in the logical volume by the block size (logical offset of data/524288). The logical offset of the data must be 512 KiB aligned. |
region | string | AWS region (default: us-east-1) |
snapshot_id | string | The ID of the snapshot. If the specified snapshot is encrypted, you must have permission to use the KMS key that was used to encrypt the snapshot. For more information, see Using encryption in the Amazon Elastic Compute Cloud User Guide.. |
x-amz-Checksum | string | A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported. |
x-amz-Checksum-Algorithm | string | The algorithm used to generate the checksum. Currently, the only supported algorithm is SHA256. |
x-amz-Data-Length | integer | The size of the data to write to the block, in bytes. Currently, the only supported size is 524288 bytes. Valid values: 524288 |
maxResults | integer | The maximum number of blocks to be returned by the request. Even if additional blocks can be retrieved from the snapshot, the request can return less blocks than MaxResults or an empty array of blocks. To retrieve the next set of blocks from the snapshot, make another request with the returned NextToken value. The value of NextToken is null when there are no more blocks to return. |
pageToken | string | The token to request the next page of results. If you specify NextToken, then StartingBlockIndex is ignored. |
startingBlockIndex | integer | The block index from which the list should start. The list in the response will start from this block index or the next valid block index in the snapshot. If you specify NextToken, then StartingBlockIndex is ignored. |
x-amz-Progress | integer | The progress of the write process, as a percentage. |
SELECT examples
- get_snapshot_block
- list_snapshot_blocks
Returns the data in a block in an Amazon Elastic Block Store snapshot. You should always retry requests that receive server (5xx) error responses, and ThrottlingException and RequestThrottledException client error responses. For more information see Error retries in the Amazon Elastic Compute Cloud User Guide.
SELECT
block_data,
checksum,
checksum_algorithm,
data_length
FROM aws.ebs.snapshot_blocks
WHERE snapshot_id = '{{ snapshot_id }}' -- required
AND block_index = '{{ block_index }}' -- required
AND blockToken = '{{ blockToken }}' -- required
AND region = '{{ region }}' -- required
;
Returns information about the blocks in an Amazon Elastic Block Store snapshot. You should always retry requests that receive server (5xx) error responses, and ThrottlingException and RequestThrottledException client error responses. For more information see Error retries in the Amazon Elastic Compute Cloud User Guide.
SELECT
block_size,
blocks,
expiry_time,
next_token,
volume_size
FROM aws.ebs.snapshot_blocks
WHERE snapshot_id = '{{ snapshot_id }}' -- required
AND region = '{{ region }}' -- required
AND pageToken = '{{ pageToken }}'
AND maxResults = '{{ maxResults }}'
AND startingBlockIndex = '{{ startingBlockIndex }}'
;
REPLACE examples
- put_snapshot_block
Writes a block of data to a snapshot. If the specified block contains data, the existing data is overwritten. The target snapshot must be in the pending state. Data written to a snapshot must be aligned with 512-KiB sectors. You should always retry requests that receive server (5xx) error responses, and ThrottlingException and RequestThrottledException client error responses. For more information see Error retries in the Amazon Elastic Compute Cloud User Guide.
REPLACE aws.ebs.snapshot_blocks
SET
BlockData = '{{ BlockData }}'
WHERE
snapshot_id = '{{ snapshot_id }}' --required
AND block_index = '{{ block_index }}' --required
AND `x-amz-Data-Length` = '{{ x-amz-Data-Length }}' --required
AND `x-amz-Checksum` = '{{ x-amz-Checksum }}' --required
AND `x-amz-Checksum-Algorithm` = '{{ x-amz-Checksum-Algorithm }}' --required
AND region = '{{ region }}' --required
AND BlockData = '{{ BlockData }}' --required
AND `x-amz-Progress` = '{{ x-amz-Progress}}'
RETURNING
checksum,
checksum_algorithm;