Skip to content

Commit 6cc426e

Browse files
authored
chore(ecs): add documentation to clarify that ECS clusters and their capacity providers (#35218)
Document ECS cross-stack capacity provider limitation ### Issue # (if applicable) Closes #35210. ### Reason for this change Users encounter circular dependency errors when trying to add ECS capacity providers from different stacks. The AWS CDK framework automatically creates bidirectional dependencies in cross-stack scenarios: 1. **Forward Dependency**: `ClusterStack` → `CapacityStack` (cluster needs capacity provider reference) 2. **Reverse Dependency**: `CapacityStack` → `ClusterStack` (capacity provider instances need cluster configuration) This creates a circular dependency that CloudFormation cannot resolve. The current documentation does not clearly communicate this limitation, leading to user confusion. ### Description of changes Added clear documentation notes in the ECS README to communicate that cross-stack ECS capacity provider registration is not supported by the CDK framework: - Added a note in the main Capacity Providers section referencing the limitation - Added a detailed note in the Auto Scaling Group Capacity Providers section explaining the constraint - Provides clear guidance to deploy clusters and capacity providers in the same stack This is a documentation-only change that clarifies existing behavior rather than introducing new functionality or breaking changes. ### Describe any new or updated permissions being added No new or updated IAM permissions are needed - this is a documentation-only change. ### Description of how you validated changes - Verified the documentation renders correctly in markdown - Confirmed no code changes were made that could affect functionality - Existing tests continue to pass unchanged ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 422e864 commit 6cc426e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

packages/aws-cdk-lib/aws-ecs/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,6 +1591,8 @@ it in the constructor. Then add the Capacity Provider to the cluster. Finally,
15911591
you can refer to the Provider by its name in your service's or task's Capacity
15921592
Provider strategy.
15931593

1594+
> **Note**: Cross-stack capacity provider registration is not supported. The ECS cluster and its capacity providers must be created in the same stack to avoid circular dependency issues.
1595+
15941596
By default, Auto Scaling Group Capacity Providers will manage the scale-in and
15951597
scale-out behavior of the auto scaling group based on the load your tasks put on
15961598
the cluster, this is called [Managed Scaling](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/asg-capacity-providers.html#asg-capacity-providers-managed-scaling). If you'd

0 commit comments

Comments
 (0)