Skip to content
betterstack-alchemyUnofficial

Cloud.ServerPool

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

A server pool keeps warm servers of one type booted and waiting, so a claim gets a running server in under a second. Warm servers are booted and billed while they wait: minSize/maxSize set how many, and enabled: false removes them all while keeping the settings.

image, snapshotId, serverType, publicIpv4, teamId and availabilityZone replace the pool; the sizes, multipliers, idleMinutes, enabled, defaults and name change in place. Set one of image or snapshotId. defaults.metadata is a JSON string of tags (JSON.stringify({ role: "worker" })), as the API takes it.

Ownership. The API keeps no metadata for it, so the generated name (it ends in the resource instance’s random suffix) is what identifies an object this stack created: a create interrupted before its state was saved is found by that name on the next deploy. An explicitly named object can’t be told apart from someone else’s (it is taken over only with --adopt), and list returns every object.

Two warm AM1 servers

yield* BetterStack.Cloud.ServerPool("workers", {
image: "ubuntu-26-04",
serverType: "AM1",
minSize: 1,
maxSize: 2,
defaults: { sshKeys: [key.slug] },
});

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.

defaults CreateServerPoolRequestDefaults

What every warm server gets when it boots, such as ssh_keys, firewalls, private networks and tags. When a claim adds nothing to these, the server is ready as soon as the claim returns.

enabled boolean

Whether the pool keeps warm servers. A disabled pool removes all its warm servers and keeps its settings. A claim on a disabled pool is refused.

growthMultiplier number

The factor target_size is multiplied by when a claim finds the pool empty, from 1 to 10. 1 turns growing off.

idleMinutes number

Minutes without a claim before the pool shrinks, from 1 to 1440.

image string

The slug of the base image the warm servers boot from, or null for a pool that boots from a snapshot. Can't be changed after the pool is created. At least one of image or snapshot_id must be configured.

maxSize number

The most warm servers the pool aims for. Together, the max_size of all the organization's pools can't be more than its server_pool_size quota.

minSize number

The fewest warm servers the pool aims for, from 0 up to max_size.

name string

The pool's name, unique in the team: up to 63 lowercase letters, digits and hyphens. Defaults to a unique name generated from the stack, stage and logical id. Changes in place.

publicIpv4 boolean

Whether the warm servers get a public IPv4 address. A warm server without one has only IPv6. Can't be changed after the pool is created.

serverType string

The server type of the warm servers. For a pool that boots from a snapshot, it's the snapshot's type. Can't be changed after the pool is created.

shrinkMultiplier number

The factor target_size is multiplied by each minute while the pool is full and has had no claim for idle_minutes. More than 0 and at most 1. 1 turns shrinking off.

snapshotId string

The ID of the snapshot the warm servers boot from, or null for a pool that boots from an image. Can't be changed after the pool is created. At least one of image or snapshot_id must be configured.

teamId string

Team that owns the resource, such as t123. Defaults to the credentials' team (BETTERSTACK_TEAM_ID, or the profile's team). Changing it replaces the resource.

availabilityZone string always set

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

id string always set

The pool's ID.

available number

How many warm servers a claim can get now.

claimsTotal number

How many claims the pool has served.

createdAt string

When the pool was created.

defaults ServerPoolDefaults

What every warm server gets when it boots, such as ssh_keys, firewalls, private networks and tags. When a claim adds nothing to these, the server is ready as soon as the claim returns.

enabled boolean

Whether the pool keeps warm servers. A disabled pool removes all its warm servers and keeps its settings. A claim on a disabled pool is refused.

growthMultiplier number

The factor target_size is multiplied by when a claim finds the pool empty, from 1 to 10. 1 turns growing off.

idleMinutes number

Minutes without a claim before the pool shrinks, from 1 to 1440.

image string | null

The slug of the base image the warm servers boot from, or null for a pool that boots from a snapshot. Can't be changed after the pool is created. At least one of image or snapshot_id must be configured.

maxSize number

The most warm servers the pool aims for. Together, the max_size of all the organization's pools can't be more than its server_pool_size quota.

minSize number

The fewest warm servers the pool aims for, from 0 up to max_size.

name string

The pool's name, unique in the team. Up to 63 lowercase letters, digits and hyphens, starting and ending with a letter or digit. Warm servers are named after the pool, with 6 hex characters added, until a claim renames them.

publicIpv4 boolean

Whether the warm servers get a public IPv4 address. A warm server without one has only IPv6. Can't be changed after the pool is created.

serverType string

The server type of the warm servers. For a pool that boots from a snapshot, it's the snapshot's type. Can't be changed after the pool is created.

shrinkMultiplier number

The factor target_size is multiplied by each minute while the pool is full and has had no claim for idle_minutes. More than 0 and at most 1. 1 turns shrinking off.

snapshotId string | null

The ID of the snapshot the warm servers boot from, or null for a pool that boots from an image. Can't be changed after the pool is created. At least one of image or snapshot_id must be configured.

targetSize number

The number of warm servers the pool aims for, from min_size to max_size. The target changes as claims come in, and is 0 while the pool is disabled.

teamId string

The ID of the team that owns the pool and its servers.

updatedAt string

When the pool was last updated.

warming number

How many warm servers are still booting.

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

id string required

The pool's ID.

availabilityZone string

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