PutSnapshotBlock - Amazon Elastic Block Store
AWS services or capabilities described in AWS documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with AWS services in China.

PutSnapshotBlock

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-byte sectors.

Request Syntax

PUT /snapshots/snapshotId/blocks/blockIndex HTTP/1.1 x-amz-Data-Length: DataLength x-amz-Progress: Progress x-amz-Checksum: Checksum x-amz-Checksum-Algorithm: ChecksumAlgorithm BlockData

URI Request Parameters

The request uses the following URI parameters.

blockIndex

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.

Valid Range: Minimum value of 0.

Required: Yes

Checksum

A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported.

Length Constraints: Maximum length of 64.

Pattern: ^[A-Za-z0-9+/=]+$

Required: Yes

ChecksumAlgorithm

The algorithm used to generate the checksum. Currently, the only supported algorithm is SHA256.

Length Constraints: Maximum length of 32.

Pattern: ^[A-Za-z0-9]+$

Valid Values: SHA256

Required: Yes

DataLength

The size of the data to write to the block, in bytes. Currently, the only supported size is 524288.

Valid values: 524288

Required: Yes

Progress

The progress of the write process, as a percentage.

Valid Range: Minimum value of 0. Maximum value of 100.

snapshotId

The ID of the snapshot.

Length Constraints: Minimum length of 1. Maximum length of 64.

Pattern: ^snap-[0-9a-f]+$

Required: Yes

Request Body

The request accepts the following binary data.

BlockData

The data to write to the block.

The block data is not signed as part of the Signature Version 4 signing process. As a result, you must generate and provide a Base64-encoded SHA256 checksum for the block data using the x-amz-Checksum header. Also, you must specify the checksum algorithm using the x-amz-Checksum-Algorithm header. The checksum that you provide is part of the Signature Version 4 signing process. It is validated against a checksum generated by Amazon EBS to ensure the validity and authenticity of the data. If the checksums do not correspond, the request fails. For more information, see Using checksums with the EBS direct APIs in the Amazon Elastic Compute Cloud User Guide.

Required: Yes

Response Syntax

HTTP/1.1 201 x-amz-Checksum: Checksum x-amz-Checksum-Algorithm: ChecksumAlgorithm

Response Elements

If the action is successful, the service sends back an HTTP 201 response.

The response returns the following HTTP headers.

Checksum

The SHA256 checksum generated for the block data by Amazon EBS.

Length Constraints: Maximum length of 64.

Pattern: ^[A-Za-z0-9+/=]+$

ChecksumAlgorithm

The algorithm used by Amazon EBS to generate the checksum.

Length Constraints: Maximum length of 32.

Pattern: ^[A-Za-z0-9]+$

Valid Values: SHA256

Errors

For information about the errors that are common to all actions, see Common Errors.

AccessDeniedException

You do not have sufficient access to perform this action.

HTTP Status Code: 403

InternalServerException

An internal error has occurred.

HTTP Status Code: 500

RequestThrottledException

The number of API requests has exceed the maximum allowed API request throttling limit.

HTTP Status Code: 400

ResourceNotFoundException

The specified resource does not exist.

HTTP Status Code: 404

ServiceQuotaExceededException

Your current service quotas do not allow you to perform this action.

HTTP Status Code: 402

ValidationException

The input fails to satisfy the constraints of the EBS direct APIs.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: