Our median CI job runs for 51 seconds. GitHub billed each one as a full minute, on a 2-core machine that our test suites could not outgrow.

This is the first of five posts about what we built instead: every job gets its own EC2 instance, which boots, runs that one job, and terminates. This post covers the idea, the alternatives, and the numbers. The others cover what it took to keep it true in production.

Timeline of one job: 26 s from queue to start, 60 s of job, then shutdown and terminate

What we tried first

We run about 32,000 CI jobs a month across some 80 private repositories. More than half finish in under a minute. GitHub's pricing page says it plainly: "GitHub rounds the minutes and partial minutes each job uses up to the nearest whole minute." A 51 second job and a 9 second job cost the same.

So we did what everyone does. We sharded the big suites, added path filters so a pull request ran only the jobs it touched, and merged tiny jobs that spent more time on setup than on work. The bill went down. No job got faster.

That was the moment the approach broke. Our largest suites are import-bound: a few seconds to load and transform each test file, times a few hundred files. On 2 vCPUs the test runner uses one worker. Sharding spreads that work over more machines, and each new machine pays for checkout and install again. The machine was the limit, and we could not change the machine.

Why not buy it

Per-minute list prices for a Linux runner, November 2026:

Option 2 vCPU 4 vCPU 8 vCPU Billing unit Code runs in
GitHub-hosted, x64 $0.006 $0.012 $0.022 whole minute, rounded up GitHub
GitHub-hosted, arm64 $0.005 $0.008 $0.014 whole minute, rounded up GitHub
A managed runner SaaS $0.0025 — — whole minute, rounded up the vendor
Ours: EC2 Graviton spot $0.0007 $0.0016 $0.0031 per second, plus a boot our account

Price per minute of a 2, 4 and 8 vCPU runner: GitHub x64, GitHub arm64, a managed SaaS and our spot Graviton

A rate hides the run time, so here is one real job, one of our larger test suites. The rows marked "est." assume the run time we measured on our own Graviton of the same size. We did not buy larger GitHub runners to test them.

Runner Run time Billed as Cost per job
GitHub x64, 2 vCPU 484 s 9 min $0.054
GitHub arm64, 2 vCPU (est.) ~343 s 6 min $0.030
GitHub arm64, 8 vCPU (est.) ~86 s 2 min $0.028
Ours, 8 vCPU spot 86 s 112 s $0.0058

GitHub's larger runner would be as fast as ours and five times the price. The managed services we looked at were good products. They lost on two things we cared about: billing still rounded per job, and our code would run in someone else's account, with a vendor holding a key that can register runners for the whole organisation.

One job, one instance

Architecture: GitHub webhook to Lambda, worker launches EC2 from a JIT config, reaper and reconcile close the loop

The control plane is four Lambda functions and one DynamoDB table, in TypeScript, deployed the same way as every other backend service we run. That was the point of the choice: no new deploy pipeline, no new monitoring, nothing new to be on call for.

  • A webhook receives GitHub's workflow_job events and checks their signature.
  • A worker handles each event. For a queued job it asks GitHub for a just-in-time runner registration and launches one spot instance with it.
  • A reaper runs every 5 minutes and a reconcile every 30. They exist because GitHub's events arrive late, twice, or never. Most of the code lives here, and most of this series is about it.

The instance boots from an image that already holds the runner and every tool. The whole boot script is this:

#!/bin/bash set -euo pipefail shutdown -h +375 # hard stop above the 360 min job timeout trap 'shutdown -h now' EXIT cd /home/runner/actions-runner sudo -u runner ./run.sh --jitconfig "<jit config from the worker>" 

The runner takes one job and exits. The trap runs shutdown, and the launch template turns a shutdown into a termination. There is no agent on the instance and no idle timer.

A job picks its machine with a label: [self-hosted, linux, arm64] for 2 vCPUs, arm64-4vcpu, arm64-8vcpu. The size labels never include plain arm64, because of the one fact that shaped everything else:

GitHub does the matching, not us. When a runner connects, GitHub hands it the oldest queued job whose labels it satisfies. The instance we launched for job A often runs job B. We do not route jobs. We only make sure the number of runners follows the number of queued jobs.

Does it work

The last seven days, to 25 November 2026, from the table where the worker records every job:

repositories using the runners 40
jobs 2,348
cost on EC2 (spot price × billed seconds) $13.39
same jobs on same-size GitHub runners $63.73
queue to start, median 28 s
jobs that lost their spot instance mid-run 24
share launched on demand instead of spot 0 %

The GitHub figure prices each job at GitHub's list rate for a runner of the same size, rounded up to the minute. It is an estimate of a bill we no longer get, not a bill.

Speed matters more to us than the cost. Going from 2 to 8 vCPUs made every suite we measured 3 to 5 times faster, on the same commit, median of two runs. The unit-test stage of our largest repository went from about 8 minutes to about 1.5.

The job log tells you where a job ran, since nobody can log in to a machine that no longer exists:

The "Set up runner" step of a job log: instance type, spot, vCPU and memory

Security, briefly

  • Private repositories only. A fork pull request on a public repository runs any code it likes, so three independent checks refuse public repositories.
  • Instances have no IAM role. Jobs that need AWS use OIDC, as they did on GitHub's runners.
  • The runners live in an AWS account separate from production, in their own VPC.
  • The just-in-time config is a credential. It travels in user data and is never logged.
  • The control plane can only launch and terminate instances that carry the runner tag.

What it does not do

  • It is slower to start. GitHub starts a hosted job in about 2 seconds. Ours waits 26 to 28. A 5 second lint job is worse off here, and we left those on GitHub.
  • No warm pool. An idle instance would hide the boot for the first job of a burst only. Nobody has asked for it yet.
  • arm64 first. There is an x64 pool at 2 vCPUs and no larger x64 sizes, because nothing needed one. A repository has to pass on arm64 before it moves.
  • CI only. Deploys still run where they ran before.
  • A spot instance can be taken away mid-job. It happens a few times a day. What we do about it took three attempts and has its own post.

What we took from it

  • Per-second billing changes the question. Once the rounding is gone, a bigger machine costs about the same per job whenever the speed-up matches the price step, and the boot is a cost you can see. Eight vCPUs cost 4.4 times two; our suites ran 3 to 5 times faster on them.
  • Measure a suite at three sizes before sharding it further. Ours were parallel work starved of cores.
  • The launch path is the easy part. It took two days. The next three weeks went into the ways a job can get lost between GitHub and EC2.

The series

  • Part 2: GitHub sends events late, twice, or never
  • Part 3: EC2 says no in four ways
  • Part 4: A spot instance can vanish mid-job
  • Part 5: Where 26 seconds go