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.
| Module | Applied by | Creates |
|---|---|---|
bootstrap | Platform team, once per account and Region | KMS 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-image | Repository workflow | Image artifact upload, build role, MicroVM image (arm64 or x64, Docker on) |
repo-runner | Repository workflow | Webhook, queue + DLQ, dispatcher, sweeper, state table, runner role, webhook secret (write-only), alarms |
03 · Job lifecycleFrom queued to terminated
| Failure | Handling |
|---|---|
| Duplicate webhook delivery | A DynamoDB conditional claim on the job id drops the second launch. |
| Lost webhook | The 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 lost | GitHub removes a JIT runner after its job. The sweeper sees the runner gone and terminates the VM. |
| Capacity or quota reached | The claim is released and SQS retries for about an hour. The queue-age alarm fires after 10 minutes. |
RunMicrovm fails | The 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 hangs | GitHub cancels at timeout-minutes. Lambda kills the VM at 65 minutes, and the reaped alarm fires. |
04 · Repo isolationRepositories sharing an account stay apart
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.
| Option | Start time | Isolation | Idle cost | Verdict |
|---|---|---|---|---|
| Reuse a running VM | Fastest | ✗ inherits the previous job's state | Full compute | Rejected |
| Suspend after the job, resume for the next one | Fast | ✗ same dirty state | Snapshot storage, uses memory quota | Rejected |
| Fresh VM per job, terminate after | Snapshot start + registration | ✓ clean every time | None | Chosen |
| Warm pool of clean, never-registered VMs | Slightly faster | ✓ still one job per VM | Snapshot storage, uses memory quota | Only 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
| Provider | Constraint | Why |
|---|---|---|
| Terraform | >= 1.11 (tested with 1.17.2) | Ephemeral resources and write-only arguments keep secrets out of state. |
hashicorp/aws | >= 6.73, < 7.0 | Lambda, SQS, DynamoDB, IAM, aws_lambdacore_network_connector |
hashicorp/awscc | >= 1.110, < 2.0 | awscc_lambda_microvm_image exposes hooks, memory and capabilities. |
hashicorp/random | >= 3.7, < 4.0 | Ephemeral 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
- Platform, once per account: apply
bootstrapwith the VPC, subnets and the list of repositories. Put{"app_id":…,"private_key":"…"}into thegithub_app_secret_arnsecret out of band. - GitHub App: grant repository permissions Administration: write and Actions: read, install it only on onboarded repositories.
- Repository: create the
runnersEnvironment (required reviewers,mainonly), and set the variablesRUNNERS_DEPLOY_ROLE_ARN,RUNNERS_STATE_BUCKETandRUNNERS_STATE_KEYfrom the bootstrap outputs. - Deploy: copy
examples/consumer-repo(all samples: Tests & samples). The workflow verifies release checksums and attestations, plans, archives the plan and applies it. - Webhook: add a repository webhook to
webhook_urlwith content type JSON, only the Workflow jobs event, and the secret fromwebhook_secret_arn. - Use it:
runs-on: [self-hosted, linux, arm64, microvm]andtimeout-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
| Item | Value |
|---|---|
| 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 MicroVM | 16 vCPU, 32 GB RAM, 32 GB disk, 8 h |
| Account memory quota | 400 GB per Region by default; running and suspended VMs count. New accounts may start lower. |
RunMicrovm rate | 5 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.