Skip to main content

Deploy raw CloudFormation stacks natively, no wrapper CLI required

· 3 min read
Erik Osterman
Founder @ Cloud Posse

CloudFormation deployments need more than a template: they need parameters for each environment, a changeset review, and a way to inspect the result. Rain users also need a maintained deployment tool now that Rain is archived. Atmos provides these workflows through native CloudFormation components.

atmos aws cloudformation lifecycle
 
00:00.0 / 00:00.0

View the full example.

The Problem​

Managing CloudFormation with separate scripts means maintaining environment settings, changeset handling, and deployment monitoring outside the stack configuration used by other components.

The Fix​

The CloudFormation commands, also available as atmos aws cfn, use Atmos stack configuration, inheritance, authentication, and dependencies.

How to Use It​

Declare a component that points to your template:

# stacks/catalog/vpc.yaml
components:
aws/cloudformation:
vpc:
path: template.yaml
stack_name: "{{ .vars.stage }}-vpc"
parameters:
CidrBlock: "10.0.0.0/16"
capabilities:
- CAPABILITY_IAM

Import the catalog into a stack that defines vars.stage. To save typing, configure a command alias with atmos config set:

atmos config set aliases.cft "aws cloudformation"

Then preview and deploy the component:

atmos cft diff vpc -s prod
atmos cft deploy vpc -s prod
atmos cft drift detect vpc -s prod

See the Rain migration guide for directive conversion, parameter imports, and using an existing deployed stack.

Try it out​

Copy the example into a new directory and make it your own:

atmos init examples/cloudformation
cd cloudformation

Install Docker or Podman and Python 3. Configure the shortcut, start the local emulator, and deploy without an AWS account:

atmos config set aliases.cft "aws cloudformation"
atmos validate stacks
atmos emulator up aws -s local
atmos cft deploy demo -s local
atmos cft output demo -s local

When finished, delete the demo stack and stop the emulator:

atmos cft delete demo -s local --auto-approve
atmos emulator down aws -s local

Get Involved​

CloudFormation components are experimental. See the configuration reference, open an issue, or share feedback in Cloud Posse's community Slack.