Skip to content
betterstack-alchemyUnofficial

Cloud.Snapshot

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

An on-demand snapshot of a Server’s own disk: “The server keeps running, and its disk can be slower while we copy it.” Attached volumes aren’t included (see VolumeSnapshot). The deploy waits until the snapshot is available (a failed one fails with WaitFailed and is removed again). A snapshot of a running server is crash-consistent: stop the server, or flush its databases, first when that matters.

Snapshots and schedules. A ScheduledSnapshot is a schedule that takes server 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. It bills by sizeBytes: “The size of the server’s root disk when the snapshot was taken, in bytes. We bill by this size.”

Updates and replacement. name and metadata change in place; serverId (and the zone) take a new snapshot. The snapshot outlives its server: it can still be read, restored and deleted after the server is gone.

Restoring. Restoring is an action, not desired state, so no prop restores: restore_snapshot creates a new server (and restore_server rolls the origin server back), and Server’s create takes no snapshot id. The one create-time pairing is ServerPool’s snapshotId: its warm servers boot from the snapshot (changing it replaces the pool).

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.

A golden image of a configured server

const golden = yield* BetterStack.Cloud.Snapshot("golden", {
serverId: server.id,
name: "web-golden",
metadata: { role: "web" },
});

Warm servers that start from the snapshot

yield* BetterStack.Cloud.ServerPool("web-pool", {
snapshotId: golden.id,
minSize: 1,
maxSize: 2,
});

serverId string required

The ID of the server to create a snapshot of.

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 server's name followed by the date.

availabilityZone string always set

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

id string always set

The 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 failed.

lock SnapshotLock | null

Our lock on the snapshot, or null unless we've locked it. A locked snapshot can't be changed, deleted or restored.

metadata unknown

Your own tags, as string keys and values.

name string

The snapshot's name.

serverId string

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

sizeBytes number | null

The size of the server's root disk when the snapshot was taken, in bytes. We bill by this size. Is null until the snapshot is taken.

snapshotType "manual" | "scheduled"

Whether the snapshot was taken on request or by a schedule. Possible values: manual, scheduled.

status string

The snapshot's status. After you create a snapshot, get it until its status is available. Only an available snapshot can be restored.<br/>Valid values:<br/>pending: We're creating the snapshot.<br/>available: The snapshot is ready, and you can restore it.<br/>failed: Creating the snapshot failed. 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.

Snapshot.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.