MicroVM GitHub Runners

IAM designPolicies and guardrails that scale with the number of repositories

Design rule: nothing in IAM policies, SCPs, RCPs, key policies or platform configuration grows with the number of repositories. A repository costs a fixed set of roles and resources. Once an account's quotas are reached, you add another account (a cell), not a bigger policy.

Phase 1 implemented · 2026-11-21

Status (2026-11-22): phases 1 and 2 are implemented and tested against real AWS and GitHub (details on Tests & samples).

TodayWhat grows with each repository

ItemLimit it hitsReplaced by
One managed boundary policy per repository1,500 customer managed policies per account by default (10,000 at most)One generic boundary per account
Boundary size grows with job_parameter_paths, job_secret_prefixes and additional_job_actions6,144 characters per managed policy; already at 5,768 with defaultsFixed-size policy built with policy variables. Extra secrets and parameters are shared by tagging them (opt-in). Extra job actions are set once per account.
boundaries map in /<prefix>/platform/config4 KB for a Standard SSM parameter (about 40 repositories)One boundary_arn value
ALLOWED_REPOSITORIES in the broker's environment4 KB of Lambda environment variablesRegistry: one SSM parameter per repository, /<prefix>/registry/<id>
check "repository_onboarded" and boundaries[repo] in repo-runner and runner-imageGrows with the map aboveReading the repository's registry parameter, which fails if the repository isn't onboarded
A per-repository deploy role and an apply of bootstrap for every onboardingRole quota, and a platform-team change for each repositoryPhase 2: one shared deploy role, reached through a tagging broker (the tagger) that sets session tags. Onboarding then only writes a registry entry.
Reserved concurrency of 26 per repository (webhook 20, dispatcher 5, sweeper 1)1,000 concurrent executions per account by default, and at least 100 must stay unreserved: about 34 repositoriesNo reservation by default. A per-repository cap stays available as an option. Not an IAM item, but it is the first limit you would hit.
5 roles per repository (deploy, webhook, control, runner, image build)1,000 roles per account by default, 10,000 at most: 200 or 2,000 repositoriesKept: these roles isolate repositories. Go past this with more accounts (cells).

RecommendationPrincipal-tag ABAC, with the tag used inside resource ARNs

Every repository principal carries two tags: gha-repo-id (sha256(lower(owner/repo))[:10]) and gha-repo (owner/repo in lower case). The generic policy grants permissions on ARNs built from those tags with policy variables:

arn:aws:lambda:<region>:<account>:function:gha-microvm-${aws:PrincipalTag/gha-repo-id}-*
arn:aws:ssm:<region>:<account>:parameter/gha-microvm/${aws:PrincipalTag/gha-repo-id}/*
arn:aws:secretsmanager:<region>:<account>:secret:gha/${aws:PrincipalTag/gha-repo}/*
arn:aws:s3:::gha-microvm-artifacts-<account>-<region>/${aws:PrincipalTag/gha-repo-id}/*

Why this rather than plain resource-tag ABAC (aws:ResourceTag equal to aws:PrincipalTag on every statement):

Resource tags are still used for three things:

IdentitiesWhere the tags come from

Phase 1: role tags

bootstrap creates one deploy role per repository, trusted by GitHub OIDC for one repository and Environment, and tagged with both keys. GitHub gives new repositories the immutable subject repo:<owner>@<owner_id>/<repo>@<repository_id>:environment:<env>. Set owner_id and repository_id in bootstrap.repositories (gh api repos/<owner>/<repo> --jq '.owner.id,.id') to trust exactly that subject, so a deleted and recreated repository with the same name gets nothing. Without them the trust accepts only repo:<owner>/<repo>:environment:<env>: Access Analyzer rejects a wildcard in place of an id, so a repository with the immutable subject needs its ids. All other repository roles are created by that deploy role. The policy only allows iam:CreateRole when the request carries the caller's own gha-repo-id and gha-repo values and the generic boundary. A repository can therefore only create roles of its own.

Phase 2: the tagger, with session tags

A role with session tags lets one shared deploy role serve every repository. GitHub can't provide this on its own. AssumeRoleWithWebIdentity takes session tags only from a https://aws.amazon.com/tags claim in the JWT, and GitHub's OIDC tokens don't include it. A small platform function, the tagger, does it instead. Enable it with bootstrap.tagger_github_owners; the example workflow is examples/consumer-repo/.github/workflows/deploy-runners-tagger.yml.

  1. The deploy workflow assumes the shared entry role <prefix>-deploy-entry through OIDC. Its trust is repo:<owner>/*:environment:* and repo:<owner>@<owner_id>/*:environment:* (the immutable form), two lines per allowed GitHub owner. tagger_github_owners maps each owner to its numeric id, so an account that takes over a deleted owner's name matches neither line's id nor the tagger's check. It relies on GitHub's default sub templates: an organization with a custom template must adapt it. The entry role can only invoke the tagger.
  2. The workflow sends a second GitHub OIDC token, with audience <prefix>-tagger. The tagger accepts RS256 only, with a key from the issuer's JWKS (cached one hour, refreshed at most once a minute for an unknown kid). It checks the issuer and the audience exactly, and exp, nbf and iat with one minute of clock skew. It never reads sub: the repository and environment come from the repository, repository_owner and environment claims, and repository_owner_id must equal the configured owner id.
  3. The owner must be allowed, the registry entry must exist for the full repository name, and the token's environment must equal the entry's. When the entry pins a repository_id, the token's must match. A reused jti is refused (DynamoDB conditional write with a TTL, KMS encrypted, point-in-time recovery).
  4. The tagger calls sts:AssumeRole on <prefix>-deploy with session tags gha-repo-id and gha-repo, SourceIdentity=<owner>+<repo>@<run_id> for CloudTrail, and at most one hour (role chaining). It returns the credentials and never logs them.
  5. The shared deploy role trusts only the tagger, requires both tags and no other keys, and has no gha-* role tags. The boundary's TagMatchesName statement accepts its exact ARN, not a deploy* pattern. The SCP denies sts:TagSession with either key to every principal except the tagger, and protects <prefix>-deploy* and <prefix>-tagger*.

With phase 2, onboarding a repository only means writing its registry parameter. The per-repository deploy roles stay until per_repository_deploy_roles = false, so both paths can run side by side during a migration.

Generic boundary<prefix>-boundary, one per account

The same document is the deploy role's identity policy and the permissions boundary of every repository role, as before. It doesn't change when repositories are added.

ScopeHow
Functions, queues, tables, schedules, alarms, roles, log groupsNames <prefix>-${gha-repo-id}-*
MicroVM image and its VMsARN microvm-image:<prefix>-${gha-repo-id}*. Create needs aws:RequestTag/gha-repo-id equal to the caller's.
Platform-owned parameters and secrets/<prefix>/${gha-repo-id}/*, <prefix>/${gha-repo-id}/*
Job secrets and parametersBy convention gha/${gha-repo}/* and /gha/${gha-repo}/*, or anything tagged gha-repo-id=${gha-repo-id}
Artifacts and stateS3 prefix ${gha-repo-id}/
Role creationBoundary must be <prefix>-boundary. Request tags must equal the caller's.
Extra job actionsadditional_job_actions on bootstrap, the same for the whole account
Tag bound to the role nameA Deny on everything unless aws:PrincipalArn is role/<prefix>-${gha-repo-id}-* or role/<prefix>-deploy-${gha-repo-id}. If someone retags a role (for example deploy-B with A's id), it gets nothing, even without the SCP. gha-repo can't be tied to a name. It only widens reads of gha/<repo>/*, and the SCP is what protects it. Phase 2's shared deploy role needs an exception to this rule.
Explicit deniesLeaving the boundary, policy versions, users and access keys, the App secret, MicroVM shell and auth tokens, and changing gha-* tags to another value

Organization guardrailsSCP, RCP and tag policy (module org-guardrails)

Every policy is generic: it holds only the name prefix and a list of exempt administrator roles. It is the same for every account and every number of repositories. The platform team attaches it to the workload OU from the management account or a delegated administrator.

SCP: makes the tags trustworthy

RCP: second layer on data

The RCP denies access to resources tagged gha-repo-id when the caller carries a different gha-repo-id. It covers Secrets Manager, SQS, DynamoDB, CloudWatch Logs, CloudWatch and X-Ray, the RCP-supported services used here. Callers with no gha-repo-id tag are left out (Null check), so administrators and AWS services are unaffected. A job's extra identity policy (additional_runner_policy_json), even one granting *, then still can't read another repository's secrets or queues.

Tag policy

Fixes the spelling and case of gha-repo-id and gha-repo and reports resources that don't comply. Tag policies can't require a tag or check a value against a pattern. The SCP does both.

Limits to know

ScaleSize of one account (cell)

QuotaPer repositoryRepositories per account
IAM roles (1,000 by default, 10,000 at most)5 (4 with per_repository_deploy_roles = false)200 by default, 2,000 at most
Customer managed policies0No limit
Standard SSM parameters (10,000)2 or 3 plus one per running jobThousands
Lambda concurrency and MicroVM memoryDepends on loadSize per account; raise the quotas or add a cell

Past one account, assign repositories to cells. Each cell is an account with its own bootstrap, and the same SCP and RCP apply to all of them. A repository's deploy workflow points at its cell's role. Nothing is shared between cells, so a failure stays inside one cell.

MigrationBreaking changes before v0.1.0