Skip to content
Latchkey

How to Use Ephemeral Runners to Control Cost

An ephemeral runner exits after one job, so it never lingers idle and never carries state that inflates the next run.

Pass --ephemeral at registration. Paired with an autoscaler, this gives clean, cost-predictable capacity that appears for a job and disappears after.

Steps

  • Register the runner with --ephemeral.
  • Let it pick up exactly one job, then exit.
  • Have the autoscaler replace it only when the queue needs it.

Register an ephemeral runner

Terminal
./config.sh --url https://github.com/my-org \
  --token "$RUNNER_TOKEN" \
  --ephemeral \
  --name "runner-$(hostname)" \
  --labels linux,ephemeral
./run.sh   # process exits cleanly after one job

Gotchas

  • Ephemeral runners lose their cache between jobs; use a shared cache backend to keep hit rates up.
  • Each cold start reinstalls tools, so bake a custom image to avoid paying setup time every job.
  • Non-ephemeral runners can leak state and secrets across jobs, a security cost as well as a compute one.

Related guides

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