Skip to content
betterstack-alchemyUnofficial

Cloud.ValkeySnapshot

Kind ResourceType id BetterStack.Cloud.ValkeySnapshotSource src/Cloud/ValkeySnapshot.tsLive test gated Lifecycle test runs against the offline mock; a live run exists but is gated behind BETTERSTACK_TEST_CLOUD_BILLABLE=1 because it bills; live runs need the owner's go-ahead (test/Cloud/ValkeySnapshot.test.ts).

An on-demand snapshot of a managed Valkey instance, taken from its current primary (“Valkey saves its data to disk first”). The deploy waits until the snapshot is available (a failed one fails with WaitFailed and is removed again).

Snapshots and schedules. A ValkeyScheduledSnapshot is a schedule that takes snapshots of the same kind (snapshotType: "scheduled") on its own; 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. The snapshot bills by sizeBytes (“The size of the instance’s disk when the snapshot was taken, in bytes. We bill by this size.”); “Database snapshots are billed like server snapshots and share their quotas.”

Replace, never update. The API has no update for it: a new name, metadata or valkeyId takes a new snapshot and deletes the old one. The snapshot outlives its instance (deleting the instance keeps it), so it is read and deleted by its own id.

Restore is not modelled. Restoring is an action, not desired state: restore_valkey_snapshot creates a new instance from the snapshot (new IDs, hostname and passwords) and restore_valkey rolls the origin instance back. Neither fits a prop, and Valkey’s create takes no snapshot id to pair with, so nothing here restores; call Cloud.restoreValkeySnapshot 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.

Zone. A child doesn’t take its zone from its parent: it uses its own availabilityZone, else the credentials’ zone. When the parent lives in another zone, pass the parent’s along (availabilityZone: parent.availabilityZone), or every call for it answers NotFound.

A snapshot before a risky migration

const db = yield* BetterStack.Cloud.Valkey("db", { type: "VK1" });
const beforeMigration = yield* BetterStack.Cloud.ValkeySnapshot("before-migration", {
valkeyId: db.id,
name: "cache-before-migration",
metadata: { reason: "migration" },
});

By name under an instance

const existing = BetterStack.Cloud.ValkeySnapshot.lookup({
valkeyId: "42",
name: "cache-before-migration",
});

valkeyId string required

The ID of the valkey the Valkey snapshot belongs to.

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. Can't be changed after the snapshot is created: a change replaces the snapshot.

name string

The snapshot's name. Defaults to the instance's name and the date, such as cache-2026-11-24.

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.

valkeyId string always set

The ID of the [Valkey](/reference/cloud/valkey/) instance the snapshot was taken from.

createdAt string

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

failureReason string | null

Why the snapshot couldn't be created, or null unless the snapshot is failed.

lock ValkeySnapshotLock | null

Our lock on the snapshot, or null when it isn't locked.

metadata unknown

Your own tags, as string keys and values.

name string

The snapshot's name. Defaults to the instance's name and the date, such as cache-2026-11-24.

serverId string | null

The ID of the server that ran the instance's primary. The server isn't in your list of servers. Can become null after the server is deleted.

sizeBytes number | null

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

snapshotType string

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

status string

The snapshot's state. A new snapshot is ready once it's available.<br/>Valid values:<br/>pending: We're creating the snapshot.<br/>available: The snapshot is ready to restore.<br/>failed: The snapshot couldn't be created. failure_reason says why.<br/>deleting: We're removing the snapshot's data.

updatedAt string

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

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

valkeyId string

The instance's ID (not needed to find it: snapshots are addressed by id). Only snapshots of this instance.