Tuesday, November 1, 2016

AWS Cloudformation Template Parameters

An AWS Cloudformation template represents a stack (grouping) of resources. Most companies will want to deploy these stacks into multiple environments ("Development", "Staging", "Production", etc).

Cloudformation presents an easy way to do so with a combination of template parameters and mappings.

The first step is to create a parameter for your Cloudformation template

The next step is to create a mappings section. This will be used to hold different values to be used in the different environments.

Then you can combine the parameter and mappings to dynamically select the subnet like below

The advantage is that you can select dynamically select values in the CFT without changing the template at all. It also allows users who aren't familiar with Cloudformation to deploy resources into different environments.