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
- Use lowercase, hyphen-separated file names (for example
network.yml
,oidc-provider.yml
). - Keep the stack name predictable by including a
StackName
override inside the template if you have multiple environments consuming the same file. - Pair every template with parameter files that share the same base name. The deploy script relies on that pattern to find configuration automatically.
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.
Recommended practices
- Use the Transform section for common macro libraries such as AWS SAM if you want higher-level abstractions.
- Add descriptive
Metadata
blocks to document why a resource exists or which team owns it. - Keep templates idempotent; avoid
Custom::
resources that perform destructive operations unless they handle retries cleanly.
Need pointers on parameter files? Continue to the Parameters reference.