Skip to content
betterstack-alchemyUnofficial

Cloud.ValkeyScheduledSnapshot

Kind ResourceType id BetterStack.Cloud.ValkeyScheduledSnapshotSource src/Cloud/ValkeyScheduledSnapshot.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/ValkeyScheduledSnapshot.test.ts).

A schedule that snapshots a managed Valkey instance at a regular interval, always from the instance’s current primary. Free to define: the snapshots are what is stored.

frequency (hourly, daily, weekly or monthly, a calendar month) changes in place; a new valkeyId replaces the schedule. Deleting the instance removes its schedules with it. Snapshots themselves are stored (and billed) by Better Stack; see the database snapshots docs for retention and restore.

Ownership. The API keeps no metadata for it and it has no generated name, so nothing marks it as this stack’s: list enumerates it under every parent, and a create interrupted before its state was saved is not recognised by the next deploy (which creates it again, or gets the API’s conflict when its identity is unique).

What it leaves behind. The snapshots it takes are not resources of this stack: deleting the schedule (or the instance) keeps them, and they stay billed (“Snapshots outlive their database”). Remove them in Databases → Snapshots or with the SDK’s listFlatValkeySnapshot / deleteFlatValkeySnapshot.

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.

Daily snapshots of an instance

const db = yield* BetterStack.Cloud.Valkey("db", { type: "VK1" });
yield* BetterStack.Cloud.ValkeyScheduledSnapshot("daily", {
valkeyId: db.id,
frequency: "daily",
});

Reference a schedule by id

const existing = BetterStack.Cloud.ValkeyScheduledSnapshot.lookup({ valkeyId: "42", id: "7" });

frequency "monthly" | "hourly" | "daily" | "weekly" | string required

How often we create a snapshot. A monthly schedule follows calendar months.

valkeyId string required

The ID of the Valkey instance.

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.

availabilityZone string always set

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

id string always set

The schedule's ID.

valkeyId string always set

The ID of the [Valkey](/reference/cloud/valkey/) instance it snapshots.

createdAt string

When the schedule was created.

frequency "monthly" | "hourly" | "daily" | "weekly"

How often we create a snapshot. A monthly schedule follows calendar months.

lastRunAt string | null

When the schedule last ran, or null before the first run.

serverId string

The ID of the server behind the instance's current primary, which changes to the new primary's server after a failover.

updatedAt string

When the schedule was last updated.

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

id string required

The schedule's ID.

valkeyId string required

The ID of the [Valkey](/reference/cloud/valkey/) instance.

availabilityZone string

Zone the instance lives in. Defaults to the credentials' zone.