Skip to main content

snapshot_blocks

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

Overview

Namesnapshot_blocks
TypeResource
Idaws.ebs.snapshot_blocks

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
block_datastring (byte)The data content of the block.
checksumstringThe checksum generated for the block, which is Base64 encoded. (pattern: <code>^[A-Za-z0-9+/=]+$</code>)
checksum_algorithmstringThe algorithm used to generate the checksum for the block, such as SHA256. (SHA256) (pattern: <code>^[A-Za-z0-9]+$</code>)
data_lengthintegerThe size of the data in the block.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_snapshot_blockselectsnapshot_id, block_index, blockToken, regionReturns 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_blocksselectsnapshot_id, regionpageToken, maxResults, startingBlockIndexReturns 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_blockreplacesnapshot_id, block_index, x-amz-Data-Length, x-amz-Checksum, x-amz-Checksum-Algorithm, region, BlockDatax-amz-ProgressWrites 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.

NameDatatypeDescription
blockTokenstringThe block token of the block from which to get data. You can obtain the BlockToken by running the ListChangedBlocks or ListSnapshotBlocks operations.
block_indexintegerThe 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.
regionstringAWS region (default: us-east-1)
snapshot_idstringThe 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-ChecksumstringA Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported.
x-amz-Checksum-AlgorithmstringThe algorithm used to generate the checksum. Currently, the only supported algorithm is SHA256.
x-amz-Data-LengthintegerThe size of the data to write to the block, in bytes. Currently, the only supported size is 524288 bytes. Valid values: 524288
maxResultsintegerThe 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.
pageTokenstringThe token to request the next page of results. If you specify NextToken, then StartingBlockIndex is ignored.
startingBlockIndexintegerThe 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-ProgressintegerThe progress of the write process, as a percentage.

SELECT examples

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
;

REPLACE examples

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;