The following steps describe how to use the EBS direct APIs to write incremental snapshots:
-
Use the StartSnapshot action and specify a parent snapshot ID to start a snapshot as an incremental snapshot of an existing one, or omit the parent snapshot ID to start a new snapshot. This action returns the new snapshot ID, which is in a pending state.
-
Use the PutSnapshotBlock action and specify the ID of the pending snapshot to add data to it in the form of individual blocks. You must specify a Base64-encoded SHA256 checksum for the block of data transmitted. The service computes the checksum of the data received and validates it with the checksum that you specified. The action fails if the checksums don't match.
-
When you're done adding data to the pending snapshot, use the CompleteSnapshot action to start an asynchronous workflow that seals the snapshot and moves it to a completed state.
Repeat these steps to create a new, incremental snapshot using the previously created snapshot as the parent.
For example, in the following diagram, snapshot A is the first new snapshot started. Snapshot A is used as the parent snapshot to start snapshot B. Snapshot B is used as the parent snapshot to start and create snapshot C. Snapshots A, B, and C are incremental snapshots. Snapshot A is used to create EBS volume 1. Snapshot D is created from EBS volume 1. Snapshot D is an incremental snapshot of A; it is not an incremental snapshot of B or C.

The following examples show how to write snapshots using the EBS direct APIs.
Start a snapshot
The following start-snapshot8
GiB snapshot, using snapshot snap-123EXAMPLE1234567
as the parent snapshot. The new snapshot will be an incremental snapshot of the parent
snapshot. The snapshot moves to an error state if there are no put or complete requests
made for the snapshot within the specified 60
minute timeout period. The
550e8400-e29b-41d4-a716-446655440000
client token ensures idempotency for the
request. If the client token is omitted, the AWS SDK automatically generates one for you.
For more information about idempotency, see Ensure idempotency in StartSnapshot API requests.
aws ebs start-snapshot --volume-size
8
--parent-snapshotsnap-123EXAMPLE1234567
--timeout60
--client-token550e8400-e29b-41d4-a716-446655440000
The following example response for the previous command shows the snapshot ID, AWS
account ID, status, volume size in GiB, and size of the blocks in the snapshot. The snapshot
is started in a pending
state. Specify the snapshot ID in subsequent
put-snapshot-block
commands to write data to the snapshot, then use the
complete-snapshot
command to complete the snapshot and change its status to
completed
.
{
"SnapshotId": "snap-0aaEXAMPLEe306d62",
"OwnerId": "111122223333",
"Status": "pending",
"VolumeSize": 8,
"BlockSize": 524288
}
Put data into a snapshot
The following put-snapshot-block524288
Bytes of data to block index 1000
on snapshot
snap-0aaEXAMPLEe306d62
. The Base64 encoded
QOD3gmEQOXATfJx2Aa34W4FU2nZGyXfqtsUuktOw8DM=
checksum was generated using
the SHA256
algorithm. The data that is transmitted is in the
/tmp/data
file.
aws ebs put-snapshot-block --snapshot-id
snap-0aaEXAMPLEe306d62
--block-index1000
--data-length524288
--block-data/tmp/data
--checksumQOD3gmEQOXATfJx2Aa34W4FU2nZGyXfqtsUuktOw8DM=
--checksum-algorithmSHA256
The following example response for the previous command confirms the data length, checksum, and checksum algorithm for the data received by the service.
{
"DataLength": "524288",
"Checksum": "QOD3gmEQOXATfJx2Aa34W4FU2nZGyXfqtsUuktOw8DM=",
"ChecksumAlgorithm": "SHA256"
}
Complete a snapshot
The following complete-snapshotsnap-0aaEXAMPLEe306d62
. The command
specifies that 5
blocks were written to the snapshot. The
6D3nmwi5f2F0wlh7xX8QprrJBFzDX8aacdOcA3KCM3c=
checksum represents the
checksum for the complete set of data written to a snapshot. For more information about
checksums, see Use EBS direct APIs checksums to validate snapshot data earlier in this guide.
aws ebs complete-snapshot --snapshot-id
snap-0aaEXAMPLEe306d62
--changed-blocks-count5
--checksum6D3nmwi5f2F0wlh7xX8QprrJBFzDX8aacdOcA3KCM3c=
--checksum-algorithmSHA256
--checksum-aggregation-methodLINEAR
The following is an example response for the previous command.
{
"Status": "pending"
}