Skip to content
betterstack-alchemyUnofficial

Cloud.VolumeSnapshot

Kind ResourceType id BetterStack.Cloud.VolumeSnapshotSource src/Cloud/VolumeSnapshot.tsOffline only Tested against the offline mock only: the lifecycle runs against the offline mock only (test/Cloud/VolumeSnapshot.test.ts).

An on-demand snapshot of a Volume: “a point-in-time copy of a volume, stored encrypted off the machine the volume runs on. It survives the volume and its machine.” The volume stays attached and in use while it is captured, so the copy is crash-consistent. The deploy waits until the snapshot is available (a failed one fails with WaitFailed and is removed again). A volume that is busy with another change refuses the create (409, volume_busy).

Snapshots and schedules. A ScheduledVolumeSnapshot is a schedule that takes volume snapshots on its own (snapshotType: "scheduled"); this resource is one manual snapshot, taken when it is created and kept until it is destroyed. Snapshots a schedule took are never managed or listed by this resource.

Cost. “Volume snapshots are billed by the allocated size of the volume they were taken from” (sizeGb; sizeBytes: “We bill by this size.”).

Updates and replacement. name and metadata change in place; volumeId (and the zone) take a new snapshot.

Restoring. Restoring is an action, not desired state, so no prop restores: restore_volume_snapshot creates a new volume (with the snapshot’s sizeGb) attached to a server, and Volume’s create takes no snapshot id to pair with. Call Cloud.restoreVolumeSnapshot from betterstack-alchemy/sdk/services when you need one.

Ownership. The alchemy marker in metadata identifies the snapshots this stack created: an interrupted create is found again by the next deploy, and list returns only Alchemy-created snapshots.

Before an upgrade

const data = yield* BetterStack.Cloud.Volume("data", {
serverId: server.id,
sizeGb: 20,
format: "ext4",
});
yield* BetterStack.Cloud.VolumeSnapshot("pre-upgrade", {
volumeId: data.id,
name: "pg-data-pre-upgrade",
});

volumeId string required

The ID of the volume to back up.

availabilityZone string

Availability zone the resource lives in, such as us-west-2a. Defaults to the credentials' zone (BETTERSTACK_AVAILABILITY_ZONE, or the profile's). Changing it replaces the resource. A child of a resource in another zone (a firewall rule, a node pool, a snapshot of an instance outside the credentials' zone) must repeat the parent's availabilityZone: it receives only the parent's id, so its zone cannot be derived.

metadata Record<string, string>

Your own tags, as string keys and values. Changes in place; an update replaces every tag.

name string

The snapshot's name. Defaults to the volume's name and the date.

availabilityZone string always set

Availability zone the resource lives in, such as us-west-2a.

id string always set

The volume snapshot's ID, a UUID.

createdAt string

When the snapshot was taken. In ISO 8601 format, such as 2026-07-01T12:00:00Z.

failureReason string | null

Why creating the snapshot failed, or null unless the snapshot is failed.

lock VolumeSnapshotLock | null

Our lock on the volume snapshot, or null. A locked volume snapshot can't be changed, deleted or restored.

metadata unknown

Your own tags as string pairs.

name string

The snapshot's name.

sizeBytes number | null

The volume's size when the snapshot was taken, in bytes, the same as size_gb. We bill by this size. size_bytes is null until the snapshot is ready.

sizeGb number | null

The volume's size in GB. A volume restored from the snapshot gets this size.

snapshotType string

How the snapshot was created.<br/>Valid values:<br/>manual: You created the snapshot.<br/>scheduled: A snapshot schedule created it.

status string

The snapshot's state. A new snapshot is ready when it's available.<br/>Valid values:<br/>pending: We're creating the snapshot.<br/>available: The snapshot is ready, and you can restore it.<br/>failed: We couldn't create the snapshot. failure_reason says why.<br/>deleting: We're deleting the snapshot.

updatedAt string

When the snapshot was last updated. In ISO 8601 format, such as 2026-07-01T12:00:00Z.

volumeId string

The ID of the [Volume](/reference/cloud/volume/) the snapshot was taken from. The API answers null once that volume is deleted; the attributes keep the ID the props named.

VolumeSnapshot.lookup(props) reads an object this stack does not manage. It is never created, updated or deleted.

availabilityZone string

Zone, such as us-west-2a. Defaults to the credentials' zone.