1 Answer
- Newest
- Most votes
- Most comments
1
Hi, why do you want to restrict yourself to a single CloudFormation stack with CDK: it is intrinsically built to work with multiple stacks.
See https://docs.aws.amazon.com/cdk/v2/guide/stack_how_to_create_multiple_stacks.html for details on working with multiple stacks
Multiple stacks in CDK are even a best practice: https://docs.aws.amazon.com/cdk/v2/guide/best-practices.html
Separate your application into multiple stacks as dictated by deployment requirements
There is no hard and fast rule to how many stacks your application needs. You'll usually end up basing
the decision on your deployment patterns. Keep in mind the following guidelines:
It's typically more straightforward to keep as many resources in the same stack as possible, so keep them
together unless you know you want them separated.
Consider keeping stateful resources (like databases) in a separate stack from stateless resources. You
can then turn on termination protection on the stateful stack. This way, you can freely destroy or
create multiple copies of the stateless stack without risk of data loss.
Stateful resources are more sensitive to construct renaming—renaming leads to resource replacement. Therefore, don't nest stateful resources inside constructs that are likely to be moved around or renamed (unless the state can be rebuilt if lost, like a cache). This is another good reason to put stateful resources in their own stack.
Relevant content
- asked 10 months ago
