Cloud.ClickHouseScheduledSnapshot
A schedule that creates snapshots of a ClickHouse instance at a
regular interval: hourly, daily, weekly or monthly. A ClickHouse
instance runs on one node without replicas, so its latest snapshot is what
you get back when its data is lost. Snapshots outlive the instance; the
schedule doesn’t (it is gone with its instance).
frequency changes in place; clickhouseId and availabilityZone
replace the schedule.
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 listClickhouseSnapshot /
deleteClickhouseSnapshot.
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.
Scheduling snapshots
Section titled “Scheduling snapshots”A daily snapshot
const analytics = yield* BetterStack.Cloud.ClickHouse("analytics", { type: "CH1" });yield* BetterStack.Cloud.ClickHouseScheduledSnapshot("daily", { clickhouseId: analytics.id, frequency: "daily",});Looking up an existing schedule
Section titled “Looking up an existing schedule”Reference a schedule by instance and id
const existing = BetterStack.Cloud.ClickHouseScheduledSnapshot.lookup({ clickhouseId: "42", id: "7",});clickhouseId string required
The ID of the ClickHouse instance the schedule belongs to.
frequency "monthly" | "hourly" | "daily" | "weekly" | string required
How often we create a snapshot.
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.
Attributes
Section titled “Attributes”availabilityZone string always set
Availability zone the resource lives in, such as us-west-2a.
clickhouseId string always set
The ID of the ClickHouse instance the schedule belongs to.
id string always set
The schedule's ID.
createdAt string
When the schedule was created.
frequency "monthly" | "hourly" | "daily" | "weekly"
How often we create a snapshot.
lastRunAt string | null
When the schedule last created a snapshot, or null until the first one.
serverId string
The ID of the server that runs the instance.
updatedAt string
When the schedule was last updated.
Lookup
Section titled “Lookup”ClickHouseScheduledSnapshot.lookup(props) reads an object this stack does not manage. It is never created, updated or deleted.
clickhouseId string required
The ID of the ClickHouse instance.
id string required
The schedule's ID.
availabilityZone string
Zone the instance lives in. Defaults to the credentials' zone.