将 CloudFormation 模板 (YAML) 转换为对流层代码

Sam*_*ony 8 aws-cloudformation troposphere aws-cdk

我有一个用 Yaml 编写的大型 CloudFormation 模板,我想开始使用对流层。有没有什么简单的方法可以将 CF 模板转换为对流层代码?

我在这里注意到这个脚本https://github.com/cloudtools/troposphere/blob/master/troposphere/template_generator.py 这会创建一个对流层 python 对象,但我不确定是否可以输出它对流层代码。

小智 6

您可以通过将 CF YAML 转换为 JSON 并运行https://github.com/cloudtools/troposphere/blob/master/scripts/cfn2py将 JSON 文件作为参数传递来实现。