Templates

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


Location and format

Store every template under templates/. YAML (.yml or .yaml) and JSON are both 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 file names (e.g., network.yml, oidc-provider.yml)
Stack namesKeep predictable by including StackName override in template for multi-environment usage
Parameter pairingPair every template with parameter files sharing the same base name; deploy script auto-discovers configuration

Rain behavior

During deployment, the script executes:

rain deploy "<template>" --yes --config "<parameters>"
  • --yes skips interactive prompts so CI/CD stays non-blocking.
  • --config loads parameters and tags from the environment folder. If no matching file exists, Rain deploys the template with defaults.
  • To experiment with change sets or additional flags, run Rain directly from your shell or modify the deploy script to include the options you want.

For a refresher on the manual workflow, read our step-by-step guide on deploying a CloudFormation template.

Start adding CloudFormation templates

To start adding CloudFormation templates, simply add new files to the ./templates directory and commit them to the main branch of your repository to trigger the CI/CD workflow. The workflow will automatically deploy your stacks using the provided parameter files.

Here are a couple of repositories containing CloudFormation templates that you can use as a starting point:

PracticeDescription
Use Transform sectionLeverage Transform for macro libraries like AWS SAM for higher-level abstractions
Add Metadata blocksDocument why resources exist and which team owns them
Keep idempotentAvoid Custom:: resources with destructive operations unless they handle retries cleanly

Need pointers on parameter files? Continue to the Parameters reference.