GitHub Actions Workflow Template for Deploy to AWS (OIDC)
A complete, caching-enabled GitHub Actions workflow for Deploy to AWS (OIDC). Drop it in .github/workflows/ci.yml and adjust.
This template builds and tests a Deploy to AWS (OIDC) project with dependency caching and sensible defaults. It authenticates with OIDC - no static AWS keys.
The workflow
.github/workflows/ci.yml
name: Deploy
on:
push:
branches: [main]
permissions:
id-token: write
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::1234567890:role/gha-deploy
aws-region: us-east-1
- run: ./deploy.shWhat it does
- Assumes an IAM role via OIDC
- Deploys on push to main
Run it cheaper
Change runs-on: ubuntu-latest to a Latchkey label to run this same workflow at roughly 69% lower per-minute cost, with self-healing for transient failures.
Related guides
How to Use OIDC to Authenticate GitHub Actions to AWSAuthenticate GitHub Actions to AWS with OIDC - no long-lived secrets. Set up the IAM role, trust policy, and…
GitHub Actions OIDC "Failed to get ID token"Fix GitHub Actions OIDC "Failed to get ID token" - a missing id-token permission, an unset request URL, or a…