How to Matrix-Deploy to Multiple Regions With GitHub Actions
Fan the deploy job out over a region matrix so every region rolls out in parallel from one job definition.
Put your regions in strategy.matrix.region and reference matrix.region in the deploy command. Set fail-fast: false so one slow or failing region does not cancel the others, and max-parallel to bound concurrency.
Steps
- List regions under
strategy.matrix.region. - Set
fail-fast: falseso all regions report independently. - Use
matrix.regionin the deploy command.
Workflow
.github/workflows/deploy.yml
permissions: { id-token: write, contents: read }
jobs:
deploy:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 3
matrix:
region: [us-east-1, eu-west-1, ap-southeast-2]
steps:
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::123456789012:role/deploy
aws-region: ${{ matrix.region }}
- run: ./scripts/deploy.sh --region ${{ matrix.region }}Common pitfalls
- Leaving
fail-fastat its default true cancels remaining regions on the first failure, hiding which others would also fail. - Shared global resources (a single DNS record or CDN) deployed from every leg cause races; deploy global pieces once, not per region.
- Region-specific quotas can make one leg fail while others pass; treat each region result independently.
Related guides
How to Deploy a Monorepo App Selectively With GitHub ActionsDeploy only the changed app in a monorepo from GitHub Actions using a path-change detection step and a condit…
How to Deploy to AWS via OIDC With GitHub ActionsDeploy to AWS from GitHub Actions without long-lived keys by assuming an IAM role through OIDC with aws-actio…