简体   繁体   English

提供堆栈名称的 cdk synth 仍然合成项目中的所有堆栈

[英]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.

相关问题 AWS CDK 在 Synth 项目中找不到 Custom.d.ts 文件 - AWS CDK Not Finding Custom .d.ts files in project on Synth aws cdk 入门 - `cdk synth` 命令的“空”output - Getting started with aws cdk - "empty" output of `cdk synth` command Cloudformation AWS CLI 查询具有多个嵌套堆栈的所有堆栈资源 - Cloudformation AWS CLI Query ALL Stack resources with multiple nested stacks 如何在 AWS CDK 项目/堆栈中导入现有的 Aurora MySQL 集群? - How to import an existing Aurora MySQL cluster in a AWS CDK project/stack? cdk:如何停止在嵌套堆栈名称中生成随机后缀 - cdk : how to stop generating random suffix in nested stack name 使用 CodeBuildStep 的代码管道的 AWS CDK 合成器错误 - AWS CDK synth errors out for a Code Pipeline with CodeBuildStep 如何将 output AWS CDK 合成到终端/网络浏览器 [如果可能] - How to output AWS CDK synth to terminal/web browser [if possible] 如何将 AWS CDK 堆栈部署到多个账户? - How to deploy AWS CDK stacks to multiple accounts? python CDK 中的 AWS 网关负载均衡器合成失败 - Synth of AWS gateway load balancer in python CDK is failing 当我将此 BucketDeployment 添加到我的 CDK CodePipeline 时,cdk synth 永远不会完成 - When I add this BucketDeployment to my CDK CodePipeline, cdk synth never finishes
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM