-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a "How-To Define a Nested Stack" section #358
Comments
It seems the only way to define a nested stack right now is in the examples. Is there any way of using the |
@hassankhan, not right now but we have an open design ticket that will ultimately address this use case: #233 As an aside, can you describe a bit about your use case where you're using CDK but still want to use nested stacks? In particular, can you elaborate on why writing your shared code as a construct and deploying it "inline" in the same stack is not sufficient? |
Hi @rix0rrr, thanks for the reply. Our main use-case for nested stacks is something similar to the following:
Since each of these stacks has a hard dependency on the previous one, we need to ensure that they are deployed in the correct order. As far as I understand, this can be achieved in a "parent" CloudFormation stack by using the As for why we would prefer not to use a single stack - we've often found ourselves running afoul of the much-dreaded 200 Resource limit. This comes up a lot with Lambda+APIG stacks and, as far as I know, has no easy solution aside from either nested stacks or using a single Lambda for the API. |
Okay, so it boils down to the 200 resource limit, correct? You're not trying to achieve reuse between the stacks, but you are splitting up the resources (and then deploying them in order) in order to get around this limitation. Let me ask you something, as a potential future customer of a feature I've been mulling over: in my ideal future world, you would never worry or see stacks directly (unless you wanted to); you would simply add more and more resources into your CDK application, and if you approach the 200 resources limit, the system would automatically start splitting your resources over multiple stacks. Would that sound good to you, or would you prefer keeping control over slicing the resources over stacks? |
Somewhat - we deploy the same set of three stacks in each client account so there is some re-use in that sense. However, the accounts are siloed off (so largely they are unaware of each other).
This sounds really really cool! We currently make heavy use of the Serverless Framework right now, and stack splitting has been a hot topic of discussion there, too. IIRC, it wasn't ever implemented because different people have different ideas on how the stack should be split. My only concern with auto-splitting is it somewhat breaks the "logical" separation when defining them explicitly - that said, if all you want is a "stack" that supports more than 200 resources then this could definitely work 👍 I wonder if the CDK could support both use cases; there could be a |
Adding to this discussion. I think the cdk can only be really useful if the 200 resource limit for CFN templates can be dealt with. |
Depends upon resolving issue #233 |
233 is still open |
Dropping the priority and adding to the backlog. |
Moving guide issues to doc repo. |
No description provided.
The text was updated successfully, but these errors were encountered: