- Newest
- Most votes
- Most comments
Hi, if not done yet, you should probably split your cdk project in several stacks. Then , you can use 'cdk synth <stackname>' and 'cdk deploy <stackname>' to deploy one one stack.
It is usually efficient to do so when the lower levels of your infrastructure are stabilized and you need only to update the lambda definitions or their code.
It is part of CDK best practices to work with several stacks in a single CDK project: 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.
Hi. There is a possibility that you are facing this bug. https://github.com/aws/jsii/issues/3389
If possible, deploying cdk sample app, which created by cdk init sample-app --language LANGUAGE
with Python and TypeScript, then see the difference of cdk synth time.
If there is a significant difference, consider to change language may faster than solving this problem directly. //TypeScript will faster than any other language due to CDK architecture
I would need a little more information from you to diagnose the issue properly. It is possible that the problem is related to Python packages, and the lambda layer might be causing the extended CDK deployment time. I believe I have encountered a similar problem in the past, but I can't recall the solution off the top of my head. Nonetheless, I hope this information helps you navigate in the right direction.
Relevant content
- Accepted Answerasked 2 years ago
- Accepted Answerasked 3 years ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated a year ago
what are the components that are deployed ? Are you using CDK pipeline ?