CDK deploy supports CloudFormation rollback triggers
Introduced 2026-10-20 · score 0.98
HOW TO USE IT
When deploying a stack that should roll back if a monitored alarm breaches, configure `rollbackConfiguration` or pass alarm ARNs and a monitoring period to `cdk deploy`. Use the programmatic API to specify composite alarms; CLI alarm ARNs are treated as metric alarms.
cdk deploy <stack> --rollback-trigger-alarm-arns <alarm-arn-1> <alarm-arn-2> --monitoring-time-minutes <minutes>await toolkit.deploy(cloudAssemblySource, { rollbackConfiguration: { triggers: [{ arn: '<alarm-arn>', type: RollbackTriggerType.COMPOSITE_ALARM }], monitoringTimeInMinutes: 15 } });WHY THIS HELPS
Configure rollback triggers when deploying a stack that should roll back if a CloudWatch alarm breaches.
REQUIREMENTS AND LIMITATIONS
- Version: 2.1146.0
- --rollback-trigger-alarm-arns <ARN...>: CloudWatch alarm ARNs to monitor; maximum 5. CLI treats them as metric alarms. Pass the single value `none` to clear previously configured triggers.
- --monitoring-time-minutes <number>: Whole number from 0 to 180 for monitoring after deployment; the CLI option must be used together with `--rollback-trigger-alarm-arns`.
- rollbackConfiguration.triggers: List of rollback triggers; up to 5. Each trigger has a required `arn` and optional `type`; supported types are `AWS::CloudWatch::Alarm` and `AWS::CloudWatch::CompositeAlarm`. `type` defaults to metric alarm. The docs do not state that the types are mutually exclusive.
- rollbackConfiguration.monitoringTimeInMinutes: Monitoring period after the stack operation completes; defaults to CloudFormation's 0 minutes, maximum 180.
- rollbackConfiguration: `undefined` leaves rollback configuration unmanaged; `{ triggers: [] }` clears existing triggers; `{ triggers: [...] }` sets the provided triggers.
- Prerequisite: CDK deployment requires configured AWS credentials, a bootstrapped AWS environment, a configured environment for each stack, and an app with at least one stack.
- At most 5 triggers are allowed.
- Alarm ARNs must be valid.
- Monitoring time must be from 0 to 180 minutes.
- CLI alarm ARNs default to metric alarms; composite alarms are reachable via the programmatic API.
FIRST-PARTY EVIDENCE
- https://github.com/aws/aws-cdk-cli/releases/tag/aws-cdk%40v2.1146.0
- https://github.com/aws/aws-cdk-cli/pull/1881
- https://raw.githubusercontent.com/aws/aws-cdk-cli/133dfa467eb69b3317e8fbfffe4b275d512c2d95/packages/aws-cdk/lib/cli/cli-type-registry.json
- https://raw.githubusercontent.com/aws/aws-cdk-cli/133dfa467eb69b3317e8fbfffe4b275d512c2d95/packages/%40aws-cdk/toolkit-lib/lib/actions/deploy/index.ts
- https://docs.aws.amazon.com/cdk/v2/guide/deploy.html
Check the installed version and the source before using it. Entry JSON