Troposphere lets you describe AWS resources in Python and emit CloudFormation JSON or YAML. Built-in property and type checking helps catch template mistakes early.
Overview
Troposphere is a Python library for creating AWS CloudFormation descriptions by writing code instead of hand-editing large JSON documents. You compose templates with classes representing AWS resource types, set properties, and export to JSON or YAML.
The library includes validation on properties and types so incorrect attributes or missing required fields surface when you build the template, rather than only at deploy time. It covers many AWS resource types and offers basic support for OpenStack resources through Heat.
Typical usage defines a Template, adds resources such as EC2 instances with parameters, outputs, mappings, and intrinsic functions like Ref and GetAtt, then serializes the result. Installation is through pip, with an optional policy extra that pulls in awacs.
Key features
- Python-defined CloudFormation templates
- JSON and YAML export
- Property and type validation
- AWS resource type coverage
- Basic OpenStack Heat support
- Parameters, outputs, and mappings
- Intrinsic function helpers
Use cases
- Generating CloudFormation from Python
- Prototyping AWS stacks in code
- Catching template errors before deploy
- Duplicating or adapting sample templates