Scheduled and Manual Scaling
A static fleet does not need the gateway’s internal auto-scaler. Keep hosts installed, then start and stop them on a schedule (or by hand), using the gateway’s drain and capacity APIs so sessions are never killed mid-flight.
Leave internal auto-scale off
For scheduled control of static nodes:
- Keep
<gateway><autoScale><enabled>false</enabled>(installer default), or - Set
<mode>external</mode>so the gateway continues to expose capacity endpoints but never callsRunInstances/TerminateInstances.
Internal auto-scale is the AMI-catalog path described under Infrastructure. This page covers the external / scheduled path for nodes you already installed.
Scheduler API
These routes live under the gateway HTTP port (default 9000):
| Method | Path | Purpose |
|---|---|---|
| GET | /gateway/capacity | Cluster totals: availableCapacity, utilizationPercent, backendsAcceptingNewSessions, licence edition, absoluteMax. |
| GET | /gateway/capacity/by-tag?tag=gpu | Capacity filtered to backends that carry a tag. |
| GET | /gateway/backends?tag=&state= | Fleet list; filter by tag and state (draining, active, unhealthy). |
| GET | /gateway/backends/status?backendUrl= | Single backend, including activeSessions while draining. |
| POST | /gateway/backends/drain | Body { "backendUrl": "http://10.0.2.15:9005" }. Stays registered and heartbeating; no new sessions routed. |
| POST | /gateway/backends/activate | Resume routing to a drained backend. |
| POST | /gateway/backends/deregister | Force-remove from the registry. Orphans live sessions — drain and wait for zero first. |
Routes under /gateway/* are not authenticated. Protection is network reachability only. Never expose port 9000 beyond the VPC (or a tightly controlled operations subnet). Pair this with the security-group design in AWS Security Groups and Ports.
Example: business-hours fleet with EventBridge
Goal: keep a core set of backends running overnight; start extra tagged instances before the working day; drain and stop them after hours.
- Install every backend once (see Installing Backend Nodes) and leave them stopped when not needed.
- Tag EC2 instances, for example
webstream:role=backendandwebstream:pool=daytime. - Create two EventBridge Scheduler rules (or cron expressions):
- 07:30 weekdays → scale-out Lambda
- 19:00 weekdays → scale-in Lambda
- Attach each Lambda to a VPC subnet that can reach the gateway on port 9000, and grant IAM:
ec2:DescribeInstances,ec2:StartInstances,ec2:StopInstances(scoped to the backend instances or tags).
Scale-out sequence (morning)
DescribeInstancesfor the daytime pool tags; callStartInstanceson those that are stopped.- Wait until each node reappears in
GET /gateway/statsor/gateway/backends(registration after boot). - If a node was left in drain state, call
POST /gateway/backends/activatewith its advertised URL. - Optionally confirm
GET /gateway/capacityshows the expectedavailableCapacity.
Scale-in sequence (evening)
- Select the backends to retire (by EC2 tag and/or gateway tag).
- For each:
POST /gateway/backends/drainwith{ "backendUrl": "..." }. - Poll
GET /gateway/backends/status?backendUrl=...untilactiveSessionsis 0, or until a maximum wait you choose. - Call
StopInstances(do not stop while sessions remain). Prefer stop over terminate so pool accounts and Windows profiles survive for the next start.
If the drain wait can exceed the Lambda timeout, drive the poll loop from a Step Functions state machine that invokes short Lambdas, or from an SSM Automation document. The gateway API stays the same.
Why stop/start suits static nodes
- Pool accounts (
webs01…) and their profiles remain on disk — unlike a terminate/launch from AMI cycle that depends on first-boot provisioning. - If the private IP changes on restart and
advertisedUrlwas blanked or is auto-detected at startup, the node re-registers with its new address. Avoid baking a stale build-machine IP into the AMI or image. - Licence
maxBackendAppHostsstill caps the fleet regardless of how many instances your schedule starts.
Manual alternatives
- Admin console — Infrastructure Overview for managed (AMI catalog) launches when internal auto-scale is enabled.
- Direct API —
POST /gateway/autoscale/launchand/gateway/autoscale/terminatewhen the gateway has an instance profile and AMI catalog entries (internal mode). - Hand drain — call drain/activate from an operations workstation inside the VPC when taking a host offline for patching.
Limitations
- External mode never launches or terminates EC2 for you; your automation owns lifecycle.
- Drain does not disconnect existing users; plan enough wait time for long sessions, or notify users before scale-in.
- Deregister without drain orphans sessions.
- Capacity utilization reported by
/gateway/capacity(sum used / sum max) can diverge from the internal auto-scaler’s average-of-ratios figure when backends have unequalmaxSessions. For external schedules, assert decisions against/gateway/capacityand/gateway/backends. - There is no built-in EventBridge template in the product; the pattern above is an integration example you implement in your AWS account.