Skip to content

Snapshot

Source: src/AWS/EC2/Snapshot.ts

A point-in-time backup of an EBS Volume, stored in S3. Snapshots are incremental and immutable — you create new Volumes from them via snapshotId.

A snapshot is immutable once created; changing the source volumeId replaces it. Creation is asynchronous — the resource waits for the snapshot to reach the completed state before returning.

const snapshot = yield* AWS.EC2.Snapshot("DailyBackup", {
volumeId: volume.volumeId,
description: "nightly backup of the data volume",
});

The snapshot captures the volume’s state at creation time. Because snapshots are incremental, only blocks changed since the previous snapshot of the same volume are stored.

const restored = yield* AWS.EC2.Volume("Restored", {
availabilityZone: "us-east-1a",
snapshotId: snapshot.snapshotId,
});

Pass a snapshot’s snapshotId to Volume to provision a new volume pre-populated with the snapshot’s data — the standard backup/restore and clone-across-AZ pattern.