Skip to content
Latchkey

How to Scale Self-Hosted CI Runners to Zero When Idle

A self-hosted runner left running overnight bills and draws power for hours it does no work.

Static self-hosted fleets sit idle most of the day yet keep instances warm. Ephemeral runners that register per job and terminate after, with an autoscaler that scales the pool to zero when the queue is empty, remove that idle burn.

Steps

  • Run runners in --ephemeral mode so each takes one job then exits.
  • Drive scale from the queue with an autoscaler (for example actions-runner-controller on Kubernetes).
  • Set the minimum replica count to zero so no runner stays warm when idle.

Register an ephemeral runner

Terminal
./config.sh --url https://github.com/my-org/my-repo \
  --token "$RUNNER_TOKEN" \
  --ephemeral \
  --labels self-hosted,linux,x64
./run.sh

Tradeoffs

  • Scale-to-zero adds cold-start latency; the first queued job waits for a runner to boot.
  • Ephemeral runners give a clean environment per job, which also reduces state-related flakiness.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →