Use PutSnapshotBlock with an AWS SDK - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use PutSnapshotBlock with an AWS SDK

The following code example shows how to use PutSnapshotBlock.

Rust
SDK for Rust
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

async fn add_block( client: &Client, id: &str, idx: usize, block: Vec<u8>, checksum: &str, ) -> Result<(), Error> { client .put_snapshot_block() .snapshot_id(id) .block_index(idx as i32) .block_data(ByteStream::from(block)) .checksum(checksum) .checksum_algorithm(ChecksumAlgorithm::ChecksumAlgorithmSha256) .data_length(EBS_BLOCK_SIZE as i32) .send() .await?; Ok(()) }