Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert CloudFormation template (YAML) to Troposphere code

I have a large sized CloudFormation template written in Yaml, I want to start using Troposphere instead. Is there any easy way to convert the CF template to Troposphere code?

I have noticed this script here https://github.com/cloudtools/troposphere/blob/master/troposphere/template_generator.py This creates a Troposphere python object, but I am not sure if its possible to output it Troposphere code.

like image 286
Sam Anthony Avatar asked May 06 '19 07:05

Sam Anthony


People also ask

What is troposphere CloudFormation?

Troposphere is a library for creating AWS CloudFormation templates. The Troposphere library allows easier creation of the AWS CloudFormation JSON by writing Python code to describe the AWS resources. Troposphere now supports setting up an Elastigroup Custom Resource.

Does CloudFormation use Yaml?

AWS CloudFormation supports the YAML Version 1.1 specification with a few exceptions. AWS CloudFormation doesn't support the following features: The binary , omap , pairs , set , and timestamp tags.

What is AWS troposphere?

Troposphere is an open-source project that enables Python developers to use Boto3 to generate CloudFormation code in either JSON or YAML. Many AWS customers use it.


1 Answers

You can do it by converting the CF YAML to JSON and running the https://github.com/cloudtools/troposphere/blob/master/scripts/cfn2py passing the JSON file in as an argument.

like image 139
OllieB Avatar answered Nov 05 '22 08:11

OllieB