You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
(deploy): allow opting out of IncludeNestedStacks on deploy change sets (large nested hierarchies hit "Limit on the number of resources in a single stack operation exceeded") #2191
Provide a way to create deploy change sets without IncludeNestedStacks: true while keeping --method=change-set. For example, a --no-include-nested-stacks flag or a cdk.json setting.
Use case
Since #1531, cdk deploy creates change sets with IncludeNestedStacks: true. We have an app with one root stack, ~30 nested stacks, and more than 3,000 resources across the hierarchy. For that app, change set creation fails:
Limit on the number of resources in a single stack operation exceeded
The CloudFormation quota of 2,500 resources per stack operation across a nested hierarchy cannot be raised. Pinning the CLI and library back to the previous versions restored deploys.
The current workarounds all have a significant cost:
--method=direct (or CDK_METHOD=direct) removes change-set review, which our production deploys depend on.
An automatic fallback to IncludeNestedStacks: false when CreateChangeSet fails with this specific quota error.
Other information
First failing versions: CLI 2.1136.0 with aws-cdk-lib 2.265.0.
The same library upgrade also modified many resources, for example the framework Lambda runtime default change in 2.259, so the change set was large. We have not yet measured whether the same changes stay under the quota with IncludeNestedStacks: false. We are happy to share resource counts.
Update after testing: the opt-out I proposed in #2195 wouldn't help, so I closed it and opened #2196, which explains the error instead.
I deployed a synthetic hierarchy (a root stack with 6 nested stacks, 2,706 resources) in my own account. Small changes deploy fine with the default IncludeNestedStacks: true. A deployment that changes 2,600 resources fails either way: at change set creation with nested change sets, or during execution (followed by a rollback of every nested stack) without them. So the 2,500 quota counts the resources a deployment changes, and including nested stacks only makes CloudFormation report it before anything is touched. Full results are in #2196.
Our failure came from the aws-cdk-lib upgrade changing more than 2,500 resources at once, not from #1531. What would have saved us time is an error that says so, which is what #2196 adds.
Workaround for anyone who hits this: split the change into several deployments that each change fewer than 2,500 resources, for example by upgrading aws-cdk-lib in smaller steps.
Activity
feat(toolkit-lib): explain the CloudFormation resources per operation…
DiegoOrtizS commentedon Dec 2, 2026
Update after testing: the opt-out I proposed in #2195 wouldn't help, so I closed it and opened #2196, which explains the error instead.
I deployed a synthetic hierarchy (a root stack with 6 nested stacks, 2,706 resources) in my own account. Small changes deploy fine with the default
IncludeNestedStacks: true. A deployment that changes 2,600 resources fails either way: at change set creation with nested change sets, or during execution (followed by a rollback of every nested stack) without them. So the 2,500 quota counts the resources a deployment changes, and including nested stacks only makes CloudFormation report it before anything is touched. Full results are in #2196.Our failure came from the
aws-cdk-libupgrade changing more than 2,500 resources at once, not from #1531. What would have saved us time is an error that says so, which is what #2196 adds.Workaround for anyone who hits this: split the change into several deployments that each change fewer than 2,500 resources, for example by upgrading
aws-cdk-libin smaller steps.