Templates

Learn how the starter kit organizes CloudFormation templates and how Rain deploys them.


Overview

Templates live in the templates/ directory. Rain deploys each file as a separate CloudFormation stack, matching it with environment-specific parameters from parameters/<env>/.

Location and format

Store every template under templates/. Both YAML (.yml or .yaml) and JSON formats are supported.

Rain deploys each file individually, so keep tightly related resources together in one template to minimize the number of stacks you manage.

Naming conventions

ConventionDescription
File namingUse lowercase, hyphen-separated names (e.g., network.yml, oidc-provider.yml)
Stack namesOverride with StackName in parameter files for multi-environment usage
Parameter pairingMatch template and parameter file names exactly; deploy script auto-discovers configuration

Rain deployment behavior

During deployment, the script executes:

rain deploy "<template>" --yes --config "<parameters>"
FlagPurpose
--yesSkips interactive prompts so CI/CD stays non-blocking
--configLoads parameters and tags from the environment folder

If no matching parameter file exists, Rain deploys the template with defaults.

To experiment with change sets or additional flags, run Rain directly or modify the deploy script.

For a step-by-step walkthrough, read our guide on deploying a CloudFormation template.

Adding templates

Add new files to ./templates and commit to the main branch. The CI/CD workflow automatically deploys new stacks using the provided parameter files.

Template resources:

Best practices

PracticeDescription
Use Transform sectionLeverage Transform for macro libraries like AWS SAM
Add Metadata blocksDocument why resources exist and which team owns them
Keep idempotentAvoid Custom:: resources with destructive operations unless they handle retries cleanly
Use consistent taggingApply tags via parameter files for cost allocation and organization

Next steps