Skip to content

CloudFormation Commands

Inventory CloudFormation stacks and back up their templates, parameters, and outputs to disk.

backup is the reason this group exists: it walks every region in parallel and writes each stack's template and metadata to a local directory, which is the cheapest form of disaster-recovery insurance for infrastructure that was clicked together rather than committed to a repo.

Commands

cloudformation backup

Backup CloudFormation stacks and templates across regions.

aws-cloud-utilities cloudformation backup [OPTIONS]
Option Value Description
--regions TEXT Comma-separated list of regions to backup (default: all regions)
--output-dir TEXT Directory to save CloudFormation backups (default: ./cfn_backup__)
--stack-status TEXT Stack statuses to include in backup (can be specified multiple times) (repeatable) (default: CREATE_COMPLETE,UPDATE_COMPLETE,UPDATE_ROLLBACK_COMPLETE)
--parallel-regions INTEGER Number of regions to process in parallel (default: from config)
--parallel-stacks INTEGER Number of stacks to process in parallel per region (default: 2)
--format json | yaml Output format for templates and parameters (default: json)

cloudformation list-stacks

List CloudFormation stacks with details.

aws-cloud-utilities cloudformation list-stacks [OPTIONS]
Option Value Description
--region TEXT AWS region to list stacks from (default: current region)
--stack-status TEXT Filter by stack status (can be specified multiple times) (repeatable)
--all-regions flag List stacks from all regions

cloudformation stack-details

Get detailed information about a specific CloudFormation stack.

aws-cloud-utilities cloudformation stack-details STACK_NAME [OPTIONS]
Option Value Description
--region TEXT AWS region where the stack is located (default: current region)
--show-template flag Show the stack template
--show-parameters flag Show stack parameters
--show-outputs flag Show stack outputs

Examples

# Stacks in the current region, and everywhere
aws-cloud-utilities cloudformation list-stacks
aws-cloud-utilities cloudformation list-stacks --all-regions

# Filter by status (repeat the flag for multiple statuses)
aws-cloud-utilities cloudformation list-stacks --stack-status CREATE_COMPLETE --stack-status UPDATE_COMPLETE

# Detail for one stack
aws-cloud-utilities cloudformation stack-details my-stack --show-parameters --show-outputs
aws-cloud-utilities cloudformation stack-details my-stack --show-template

# Back up every stack in every region
aws-cloud-utilities cloudformation backup --output-dir ./cfn-backups

# Back up two regions as YAML, four regions in parallel
aws-cloud-utilities cloudformation backup --regions us-east-1,us-west-2 --format yaml --parallel-regions 4

# Include rolled-back stacks in the backup
aws-cloud-utilities cloudformation backup --stack-status CREATE_COMPLETE --stack-status ROLLBACK_COMPLETE

Notes

--stack-status is repeatable, not comma-separated. Pass the flag once per status. The default set is CREATE_COMPLETE, UPDATE_COMPLETE, and UPDATE_ROLLBACK_COMPLETE, which excludes deleted and in-progress stacks.

--regions on backup is comma-separated. The inconsistency is in the CLI, not this page.