Rain

Understand how the Rain CLI powers deployments in the CloudFormation starter kit.


Overview

Rain is a command-line tool that streamlines CloudFormation workflows. It deploys, diffs, and removes stacks while handling change sets and parameter files automatically.

How the starter kit uses Rain

Integration PointDescription
Deploy scriptCalls rain deploy for each template, pairing it with the matching parameter file
CI/CD workflowsInstalls latest Rain release and runs deploy script on every push to main
Local developmentRun Rain directly for previews or change sets before pushing

Default deploy command

The deploy script executes:

rain deploy "templates/<name>.yml" --yes --config "parameters/<environment>/<name>.yml"
FlagPurpose
--yesSuppresses interactive prompts so automated runs stay non-blocking
--configLoads environment-specific parameters, tags, and stack options

Common commands

Preview changes

rain deploy templates/oidc-provider.yml \
  --config parameters/test/oidc-provider.yml \
  --changeset

Shows exactly what CloudFormation will create, modify, or destroy. Review before approving.

Deploy templates

# Single template
rain deploy templates/oidc-provider.yml \
  --config parameters/test/oidc-provider.yml \
  --yes

# All templates via helper script
./scripts/deploy-templates.sh -e test

Check stack status

# List stacks
rain ls

# List all stacks (including deleted)
rain ls --all

View stack template

rain cat my-stack-name

Displays the current template for a deployed stack.

Remove a stack

rain rm my-stack-name --yes

Destroys all resources in the stack. CloudFormation handles deletion order.

View stack outputs

aws cloudformation describe-stacks \
  --stack-name my-stack-name \
  --query 'Stacks[0].Outputs'

Customizing Rain usage

CustomizationMethod
Pin a versionSet RAIN_VERSION environment variable in workflow before install step
Enable additional flagsExport RAIN_FLAGS="--changeset" and update deploy script to append to every invocation
Use profilesRain uses AWS CLI configuration; set AWS_PROFILE or AWS_DEFAULT_REGION before running

Rain vs AWS CLI

FeatureRainAWS CLI
Change setsBuilt-in with --changesetRequires multiple commands
Parameter filesNative support via --configRequires manual formatting
Stack eventsReal-time streamingRequires polling
Diff viewColor-coded template comparisonNot available
Error messagesHuman-readableTechnical

Next steps