通过 cloudformation 使用 aws `cdk synth` 输出 [英] use aws `cdk synth` output via cloudformation

查看:39
本文介绍了通过 cloudformation 使用 aws `cdk synth` 输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在现有基于 Cloudformation 的管道的环境中工作.我想知道是否可以在 CDK 中描述我的基础设施,然后生成要在管道中使用的 Cloudformation,而无需更改管道.我希望我使用 CDK 的事实完全透明.

解决方案

我通常不建议通过 CloudFormation 使用 cdk synth 的输出,除非您知道自己在做什么.>

原因如下:在某些边缘情况下,CDK 会提前进行引导和资产发布,例如对于所谓的资产来源(docker 图像、s3 文件等).

该主题与 GitHub 上 CDK 存储库中询问 CI/CD 集成的问题有一些重叠.[1]

为 CDK [2] 开发全自动 CI/CD 流程的工作正在进行中.所谓的云组件 [3] 包含通过 CloudFormation 部署所需的所有资源,但正如 RFC 指出的那样:

<块引用>

云组件包括每个堆栈和资产源(docker 图像、s3 文件等)的 CloudFormation 模板,这些源必须打包并发布到每个使用它们的环境中的资产存储.

如果您不使用任何资产或可以选择在使用 CloudFormation 之前打包和部署它们,则在提供正确的 CFN 参数时,应该可以在 CloudFormation 中使用 cdk synth 输出(因为其他人已经在此线程中指出).

参考资料

[1] https://github.com/aws/aws-cdk/issues/6894
[2] https://github.com/aws/aws-cdk-rfcs/blob/master/text/0049-continuous-delivery.md
[3] https://github.com/aws/aws-cdk/blob/master/packages/@aws-cdk/cloud-assembly-schema/README.md

I am working in an environment with existing Cloudformation based pipelines. I am wondering if it's possible to describe my infrastructure in CDK and then generate the Cloudformation to be used in the pipeline with no changes to the pipelines. I want the fact that I use CDK to be completely transparent.

解决方案

I would generally not recommend to use the output of cdk synth via CloudFormation except you know what you are doing very well.

Here is the reason why: There are some edge cases in which the CDK does bootstrapping and asset publishing in advance, e.g. for so called asset sources (docker images, s3 files, etc).

The topic has some overlap with issues in the CDK repository on GitHub asking about CI/CD integration. [1]

There is work in progress to develop a fully automated CI/CD process for the CDK [2]. The so called cloud assembly [3] contains all resources which are necessary to deploy via CloudFormation but as the RFC points out:

The cloud assembly includes a CloudFormation template for each stack and asset sources (docker images, s3 files, etc) that must be packaged and published to the asset store in each environment that consumes them.

If you are not using any assets or have the option to package and deploy them before using CloudFormation, using cdk synth output should be possible in CloudFormation when supplying the correct CFN params (as others have already pointed out in this thread).

References

[1] https://github.com/aws/aws-cdk/issues/6894
[2] https://github.com/aws/aws-cdk-rfcs/blob/master/text/0049-continuous-delivery.md
[3] https://github.com/aws/aws-cdk/blob/master/packages/@aws-cdk/cloud-assembly-schema/README.md

这篇关于通过 cloudformation 使用 aws `cdk synth` 输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆