cdk synthesize clarification
See original GitHub issue❓ General Issue
The Question
According to the documentation the cdk synthesize
command synthesizes and prints the CloudFormation template for the given stack. But in reality it prints the template of the given stack and outputs every stack’s template to cdk.out
. I don’t know if this is a bug or the intended behavior. In the latter case why was it implemented this way? Why does it print to the console and output to the directory at the same time?
Environment
- CDK CLI Version: 1.39.0 (build 5d727c1)
- Module Version:
- OS: Windows 10
- Language: CLI
Other information
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (4 by maintainers)
Top Results From Across the Web
AWS CDK Toolkit (cdk command) - AWS Documentation
All CDK Toolkit commands start with cdk , which is followed by a subcommand ( list , synthesize , deploy , etc.). Some...
Read more >With CDK, how do I synthesize stack via sdk OR how do I get ...
A stack can be accessed as a string from CDK as follows: app.synth().getStack(STACK_NAME).template (Python).
Read more >AWS CDK Pipelines: Real-World Tips and Tricks (Part 2)
Snippet of how to create a personal stage separate from the CDK pipeline. Build the CDK app and synthesise the CloudFormation templates locally...
Read more >Glossary of CDK application - Part 2
synth(): Synthesize this stage into a cloud assembly. Once an assembly has been synthesized, it cannot be modified. Subsequent calls will ...
Read more >How to become an infrastructure-as-code ninja, using AWS CDK
Our goalsFirst, let us clarify what we want to accomplish here:An EC2 ... state * `cdk synth` emits the synthesized CloudFormation template ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@suhaig thanks for letting us know about that. it seems like the documentation needs a bit of a refresh. copy @Jerry-AWS
cdk synth
prints out the given stack. If you have multiple stacks, you should see a message that indicates the stacks that were synthsized.cdk synth would render to
The printed output is intended to be human readable (which is why we render it in YAML). The
cdk.out
folder is the default directory in which the synthesized cloud assembly is stored. It’s used during deploy and stores the templates in JSON. We do not expect users to interact directly with the cloud assembly. Learn more about the cloud assembly schema here@strottos you do not need to run
synth
ahead of a deploy, the CDK will handle that for you. If a cloud assembly directory does not exist (i.e. cdk.out), it will create one, synthesize the cloud assembly, and then deploy from that assembly.Closing this issue since it seems to have been resolved by #8264. Feel free to reopen.