Skip to content
Latchkey

CDK "This stack uses assets, so the toolkit stack must be deployed"

CDK deploys assets (Lambda code, Docker images, files) through a bootstrap stack that must exist in the target account and region. That account/region was never bootstrapped, so the deploy cannot find the toolkit resources.

What this error means

cdk deploy fails asking whether the environment was bootstrapped, often citing a missing /cdk-bootstrap/.../version SSM parameter. It is deterministic: until you bootstrap that account/region, every deploy with assets fails the same way.

cdk output
❌  Deployment failed: Error: MyStack: SSM parameter /cdk-bootstrap/hnb659fds/version
not found. Has the environment been bootstrapped? Please run 'cdk bootstrap'.

Common causes

Account/region not bootstrapped

CDK needs a bootstrap stack (S3 asset bucket, ECR repo, deploy roles) per account+region. A new account or a new region has none until cdk bootstrap runs.

Bootstrap version too old for the CLI

A newer CDK CLI may require a higher bootstrap version. An outdated bootstrap stack fails the version check even though one exists.

How to fix it

Bootstrap the target environment

Run bootstrap once per account+region with credentials that can create the toolkit stack.

Terminal
cdk bootstrap aws://123456789012/us-east-1
cdk deploy MyStack

Re-bootstrap when the version is stale

  1. Check the current version: read the /cdk-bootstrap/<qualifier>/version SSM parameter.
  2. Re-run cdk bootstrap to upgrade the toolkit stack to the version the CLI needs.
  3. Keep the CDK CLI version pinned in CI so the required bootstrap version is stable.

How to prevent it

  • Bootstrap every account+region your pipeline deploys to as a one-time setup step.
  • Pin the CDK CLI version so the bootstrap version requirement does not drift.
  • Use a dedicated CI role permitted to assume the CDK deploy roles.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →