[英]cdk synth with stack name provided still synths all the stacks in the project
This is the app.py这是app.py
my_env = cdk.Environment(account="XXXXXXX", region="us-east-1")
StackA(app, "stack-a", env=my_env)
StackB(app, "stack-b", env=my_env)
Each of these stacks has a print statement specifying the stack name.这些堆栈中的每一个都有一个指定堆栈名称的打印语句。 When I run this cli command cdk synth StackA
, I get the lines below当我运行此 cli 命令cdk synth StackA
时,我得到以下几行
Inside StackA
Inside StackB
Why are both stacks sythesizing?为什么两个堆栈都在合成? How to ignore StackB when I only want StackA to execute?当我只想执行 StackA 时如何忽略 StackB?
The synth command synthesizes a CloudFormation template from your CDK code, and per CDK docs , it will always run the whole app and generates the template in the cdk.out
directory. synth 命令从您的 CDK 代码合成一个 CloudFormation 模板,根据 CDK 文档,它将始终运行整个应用程序并在cdk.out
目录中生成模板。
synth,= deploy, synth will not apply any changes. synth,= deploy,synth 不会应用任何更改。 it will only show the generated CloudFormation template.它只会显示生成的 CloudFormation 模板。
When you try to do a synth, cdk will synthesize and generate templates for all of the stacks.当您尝试进行合成时,cdk 将为所有堆栈合成并生成模板。 Passing the stack name will show the template for only that stack.传递堆栈名称将仅显示该堆栈的模板。 This behaviour can be verified by doing a cdk synth
for a project that has multiple stacks可以通过为具有多个堆栈的项目执行cdk synth
来验证此行为
cdk synth
Successfully synthesized to cdk-cdn/cdk.out
Supply a stack id (all-images, images-cdn) to display its template.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.