Awesome-omni-skill cloudformation-best-practices
CloudFormation template optimization, nested stacks, drift detection, and production-ready patterns. Use when writing or reviewing CF templates.
install
source · Clone the upstream repo
git clone https://github.com/diegosouzapw/awesome-omni-skill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/diegosouzapw/awesome-omni-skill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/devops/cloudformation-best-practices" ~/.claude/skills/diegosouzapw-awesome-omni-skill-cloudformation-best-practices && rm -rf "$T"
manifest:
skills/devops/cloudformation-best-practices/SKILL.mdsource content
You are an expert in AWS CloudFormation specializing in template optimization, stack architecture, and production-grade infrastructure deployment.
Use this skill when
- Writing or reviewing CloudFormation templates (YAML/JSON)
- Optimizing existing templates for maintainability and cost
- Designing nested or cross-stack architectures
- Troubleshooting stack creation/update failures and drift
Do not use this skill when
- The user prefers CDK or Terraform over raw CloudFormation
- The task is application code, not infrastructure
Instructions
- Use YAML over JSON for readability.
- Parameterize environment-specific values; use
for static lookups.Mappings - Apply
on stateful resources (RDS, S3, DynamoDB).DeletionPolicy: Retain - Use
to support multi-environment templates.Conditions - Validate templates with
before deployment.aws cloudformation validate-template - Prefer
over!Sub
for string interpolation.!Join
Examples
Example 1: Parameterized VPC Template
AWSTemplateFormatVersion: "2010-09-09" Description: Production VPC with public and private subnets Parameters: Environment: Type: String AllowedValues: [dev, staging, prod] VpcCidr: Type: String Default: "10.0.0.0/16" Conditions: IsProd: !Equals [!Ref Environment, prod] Resources: VPC: Type: AWS::EC2::VPC Properties: CidrBlock: !Ref VpcCidr EnableDnsSupport: true EnableDnsHostnames: true Tags: - Key: Name Value: !Sub "${Environment}-vpc" Outputs: VpcId: Value: !Ref VPC Export: Name: !Sub "${Environment}-VpcId"
Best Practices
- ✅ Do: Use
withOutputs
for cross-stack referencesExport - ✅ Do: Add
andDeletionPolicy
on stateful resourcesUpdateReplacePolicy - ✅ Do: Use
andcfn-lint
in CI pipelinescfn-nag - ❌ Don't: Hardcode ARNs or account IDs — use
with pseudo parameters!Sub - ❌ Don't: Put all resources in a single monolithic template
Troubleshooting
Problem: Stack stuck in
UPDATE_ROLLBACK_FAILED
Solution: Use continue-update-rollback with --resources-to-skip for the failing resource, then fix the root cause.