LoadBalancerPool
Source:
src/Cloudflare/LoadBalancer/Pool.ts
A Cloudflare Load Balancing pool — an account-scoped group of origin servers that Load Balancers route traffic to. Pools optionally reference a {@link LoadBalancerMonitor} for active health checking.
Requires the Load Balancing subscription on the account; without it, pool
creation fails with the typed PoolAccessFailed error.
Creating a Pool
Section titled “Creating a Pool”Pool with one origin
const pool = yield* Cloudflare.LoadBalancerPool("ApiPool", { origins: [{ name: "origin-1", address: "203.0.113.10" }],});Health-checked pool
const monitor = yield* Cloudflare.LoadBalancerMonitor("ApiMonitor", { type: "https", path: "/health", expectedCodes: "2xx",});
const pool = yield* Cloudflare.LoadBalancerPool("ApiPool", { origins: [ { name: "origin-1", address: "203.0.113.10", weight: 0.7 }, { name: "origin-2", address: "203.0.113.11", weight: 0.3 }, ], monitor: monitor.monitorId, minimumOrigins: 1,});Using with a Load Balancer
Section titled “Using with a Load Balancer”yield* Cloudflare.LoadBalancer("ApiLb", { zoneId: zone.zoneId, name: "api.example.com", defaultPools: [pool.poolId], fallbackPool: pool.poolId,});