Skip to content

AWS CDK

AWS CDK CI on GitHub Actions

cdk synth reinstalls dependencies and re-synthesises every stack.

2m → 30s
Synth

cdk synth reinstalls dependencies and re-synthesises every stack.

Why it happens

node_modules and the CDK context cache are cold on each run.

What to change

  1. Cache node_modules and cdk.out keyed on the lockfile
  2. Synthesise once and reuse the assembly for diff and deploy
  3. Use --exclusively to deploy a single stack rather than the whole app

AWS CDK on runnerhut

yaml
jobs:
deploy:
runs-on: runnerhut-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npx cdk synth
- run: npx cdk deploy --require-approval never --app cdk.out
A working starting point

The only runnerhut-specific line is `runs-on: runnerhut-4vcpu-ubuntu-2404`. Everything else is standard GitHub Actions — the same actions, the same secrets and the same permissions model you use today.

Your next build could be twice as fast, at half the price

Start free. Migrating away is the same one line, and we publish that diff too.