MicroVM GitHub Runners
v0.1 · implemented

Ephemeral GitHub runners on
AWS Lambda MicroVMs

Each repository deploys its own runners into its own AWS account with Terraform. Every job gets a fresh Firecracker VM in your VPC, runs for at most one hour, can read only that repository's secrets, and is then destroyed. Built for landing zones without NAT, with central egress and VPC endpoints.

Tested against real AWS and a real GitHub workflow. Unit tests, IAM policy simulation, a sandbox smoke test and an end-to-end run through both deploy paths. See Tests & samples for how each layer works, what it caught, and the sample repositories to start from.

01 · DecisionsWhat we built and why

Runners only, jobs of at most one hour, enterprise landing zone, DORA in scope.

Lambda MicroVMs, one job per VM

A fresh Firecracker VM per job, per-second billing and no idle cost. The one-hour cap is well inside the 8-hour MicroVM limit.

Everything inside your VPC

Lambdas and MicroVMs use your private subnets. MicroVMs attach through a VPC_EGRESS connector, never INTERNET_EGRESS. Traffic follows the Transit Gateway to central egress and inspection.

Platform-owned token broker

Only the broker reads the GitHub App key. A repository proves its IAM identity with a presigned STS call and gets a one-hour token for its own repository only.

One ABAC boundary per account

Each repository's roles carry its gha-repo-id tag. One fixed-size boundary scopes them to gha-microvm-<repo-id>-* through policy variables, and SCPs keep the tags honest. Repos sharing an account cannot touch each other. See IAM design.

Per-repo MicroVM image

Get/TerminateMicrovm are scoped to an image ARN. One image per repo means a dispatcher can only kill its own VMs.

arm64 by default, x64 available

Base image version 3 adds X86_64. Graviton is the cheaper default; pick x64 per repo when toolchains need it.

Public webhook, HMAC-verified

GitHub cannot sign SigV4, so the Function URL is public with HMAC checks by default. Set webhook_auth_type = "AWS_IAM" to accept calls only from a central ingress with WAF.

Ambient role is for CI secrets only

Every job, including pull requests, gets the runner role. Production credentials come from GitHub OIDC bound to protected Environments.

02 · ArchitectureThree modules, two accounts

The platform team applies bootstrap once per account and Region. Each repository applies runner-image and repo-runner from its own workflow.

GitHub acme/app workflow_job webhook REST API tokens · jitconfig Actions service job long-poll WORKLOAD ACCOUNT · no NAT VPC · PRIVATE SUBNETS · SG: HTTPS EGRESS ONLY REPO-RUNNER · per repository webhook λ Function URL · HMAC SQS + DLQ · KMS dispatcher λ control role DynamoDB claims · VMs · PITR sweeper λ every 2 min SSM · /gha-microvm/<id>/jit/* one-time JIT config · deleted on read Alarms → incident SNS BOOTSTRAP · per account (platform team) token broker λ verifies caller via presigned STS App key secret KMS CMK per-repo boundary OIDC deploy roles VPC_EGRESS connector ENIs in subnets RUNTIME · one MicroVM per job Lambda MicroVM Firecracker · arm64 or x64 · Docker supervisor → run.sh --jitconfig NO_INGRESS · max 65 min · KMS state runner role: gha/<owner>/<repo>/* only runner-image snapshot · runner SHA-pinned Repo secrets Secrets Manager · SSM ROUTE 0.0.0.0/0 TGW attachment all HTTPS egress Route 53 Resolver shared endpoint zones local endpoints optional mode NETWORKING ACCOUNT Central VPC endpoints sqs · ssm · kms · sts lambda · logs · secrets… Egress VPC Network Firewall allow github.com, … NAT + IGW fixed egress IPs ① HTTPS ② token request ③ RunMicrovm ④ runner long-polls GitHub · outbound only, inspected centrally AWS APIs broker & dispatcher → api.github.com (same path)
① GitHub calls the webhook → ② the dispatcher gets a repo-scoped token from the broker → ③ it launches one MicroVM in the VPC → ④ the runner reaches GitHub through the central egress. AWS APIs resolve to central (or local) VPC endpoints.
ModuleApplied byCreates
bootstrapPlatform team, once per account and RegionKMS key, artifact and state buckets, runner security group, VPC_EGRESS connector, optional local endpoints, GitHub OIDC provider, generic boundary, registry and deploy roles, token broker, App key secret, alarm topic, platform config parameter
runner-imageRepository workflowImage artifact upload, build role, MicroVM image (arm64 or x64, Docker on)
repo-runnerRepository workflowWebhook, queue + DLQ, dispatcher, sweeper, state table, runner role, webhook secret (write-only), alarms

03 · Job lifecycleFrom queued to terminated

GitHub webhook λ dispatcher λ broker λ SSM MicroVM workflow_job: queued verified → SQS claim job (conditional put) · check capacity presigned GetCallerIdentity caller = <prefix>-<id>-control ? installation token scoped to acme/app token (1 h) generate-jitconfig mvm-<job>-<n> PutParameter SecureString /jit/mvm-… RunMicrovm · payload = parameter name only /run: Get + Delete run.sh --jitconfig → long-poll (through TGW) job runs (≤ 60 min) · steps read gha/acme/app/* secrets workflow_job: completed TerminateMicrovm (only its own image) backstops: sweeper every 2 min · runner deregistered · idle 10 min · VM hard limit 65 min
The VM never sees the App key or an installation token. It reads a one-time parameter, deletes it and runs exactly one job.
FailureHandling
Duplicate webhook deliveryA DynamoDB conditional claim on the job id drops the second launch.
Lost webhookThe sweeper lists queued jobs and re-queues those waiting more than 2 minutes. Stale claims (older than 5 minutes) are re-dispatched with a new attempt number.
Runner took another job (same labels)VMs are tracked by runner name, so completed always terminates the right VM. The left-over job is re-dispatched by the sweeper.
completed webhook lostGitHub removes a JIT runner after its job. The sweeper sees the runner gone and terminates the VM.
Capacity or quota reachedThe claim is released and SQS retries for about an hour. The queue-age alarm fires after 10 minutes.
RunMicrovm failsThe JIT parameter and runner registration are deleted, the claim is released and the message is retried. It lands in the DLQ after 20 attempts.
Job hangsGitHub cancels at timeout-minutes. Lambda kills the VM at 65 minutes, and the reaped alarm fires.

04 · Repo isolationRepositories sharing an account stay apart

boundary · acme/app (id 3fa2…) deploy role (OIDC) control role webhook role runner role Can only touch: gha-microvm-3fa2…-* (λ, SQS, DDB, IAM) /gha-microvm/3fa2…/* (SSM) gha/acme/app/* (job secrets) microvm-image:gha-microvm-3fa2…* ✗ App key · ✗ other repos · ✗ shell tokens ✗ remove its boundary · ✗ new policy versions boundary · acme/ledger (id 9c01…) deploy role (OIDC) control role webhook role runner role Same rules, its own id. token broker role name proves repo token scoped to 1 repo only reader of App key ✗ app's role asking for ledger → denied
Resource names carry sha256(owner/repo)[:10], a fixed-length id, so no repository name can be a prefix of another's resources.

Details are on the security page.

ADR-001Terminate after every job, no VM reuse

Keeping a finished VM idle so the next job starts faster saves little time and breaks the guarantee that every job gets a clean VM.

OptionStart timeIsolationIdle costVerdict
Reuse a running VMFastest✗ inherits the previous job's stateFull computeRejected
Suspend after the job, resume for the next oneFast✗ same dirty stateSnapshot storage, uses memory quotaRejected
Fresh VM per job, terminate afterSnapshot start + registration✓ clean every timeNoneChosen
Warm pool of clean, never-registered VMsSlightly faster✓ still one job per VMSnapshot storage, uses memory quotaOnly if measurements show a real gap

RunMicrovm already starts from a memory snapshot. Most of the remaining delay is registration and GitHub assigning the job, and reuse removes neither.

05 · TerraformModules and inputs

# repository layout
cmd/lambda/          # one Go binary: webhook | dispatcher | sweeper | broker | tagger
cmd/supervisor/      # runs in the MicroVM: hooks, JIT fetch, dockerd, run.sh
internal/            # broker, runner (dispatch + sweep), github, webhook, awsx
image/Dockerfile     # FROM public.ecr.aws/lambda/microvms:al2023-minimal
modules/bootstrap/   modules/runner-image/   modules/repo-runner/
examples/            # bootstrap-account, consumer-repo (infra + workflows), sandbox (+ e2e)
tools/iamsim/        # renders the IAM documents for cmd/iamsim (just iam-sim)
justfile             # check · test · package · image-artifact · release-assets · deploy · drills

Providers

ProviderConstraintWhy
Terraform>= 1.11 (tested with 1.17.2)Ephemeral resources and write-only arguments keep secrets out of state.
hashicorp/aws>= 6.73, < 7.0Lambda, SQS, DynamoDB, IAM, aws_lambdacore_network_connector
hashicorp/awscc>= 1.110, < 2.0awscc_lambda_microvm_image exposes hooks, memory and capabilities.
hashicorp/random>= 3.7, < 4.0Ephemeral webhook secret

Consumer configuration

module "image" {
  source        = "github.com/aws-abaschen/terraform-aws-microvm-github-runners//modules/runner-image?ref=<release-sha>"
  repository    = "acme/app"
  artifact_path = ".release/image-arm64.zip"   # attestation-verified release asset
  architecture  = "ARM_64"                     # or X86_64
  memory_mib    = 4096                         # 2 vCPU baseline, bursts to 8
}

module "runners" {
  source          = "github.com/aws-abaschen/terraform-aws-microvm-github-runners//modules/repo-runner?ref=<release-sha>"
  repository      = "acme/app"
  lambda_zip_path = ".release/lambda.zip"
  image_arn       = module.image.image_arn
  image_version   = module.image.image_version
  architecture    = module.image.architecture
  max_job_minutes = 60        # VM hard limit = 65 min
  max_runners     = 5
  # webhook_auth_type = "AWS_IAM"  # behind a central ingress
}

Everything else (subnets, security group, connector, KMS key, broker, boundary) is read from the /gha-microvm/platform/config parameter written by bootstrap.

06 · OnboardingFrom zero to a first job

  1. Platform, once per account: apply bootstrap with the VPC, subnets and the list of repositories. Put {"app_id":…,"private_key":"…"} into the github_app_secret_arn secret out of band.
  2. GitHub App: grant repository permissions Administration: write and Actions: read, install it only on onboarded repositories.
  3. Repository: create the runners Environment (required reviewers, main only), and set the variables RUNNERS_DEPLOY_ROLE_ARN, RUNNERS_STATE_BUCKET and RUNNERS_STATE_KEY from the bootstrap outputs.
  4. Deploy: copy examples/consumer-repo (all samples: Tests & samples). The workflow verifies release checksums and attestations, plans, archives the plan and applies it.
  5. Webhook: add a repository webhook to webhook_url with content type JSON, only the Workflow jobs event, and the secret from webhook_secret_arn.
  6. Use it: runs-on: [self-hosted, linux, arm64, microvm] and timeout-minutes: 60.
# .github/workflows/ci.yml (consumer)
jobs:
  build:
    runs-on: [self-hosted, linux, arm64, microvm]
    timeout-minutes: 60
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - run: make build

07 · Costs & limitsWhat to expect

ItemValue
Runner 2 vCPU / 4 GB (us-east-1)≈ $0.0042 per minute of job, billed per second
Idle per repository≈ $1 per month (secret, alarms; Lambda, SQS and DynamoDB on demand)
Idle per account (bootstrap)KMS key, connector ENIs, optional local endpoints (≈ $7–8 per endpoint per AZ per month)
Max per MicroVM16 vCPU, 32 GB RAM, 32 GB disk, 8 h
Account memory quota400 GB per Region by default; running and suspended VMs count. New accounts may start lower.
RunMicrovm rate5 per second documented; request increases before go-live.

Prices are mid-2026 figures for us-east-1. Check the AWS Lambda pricing page for your Region.