cloudformation-best-practices

Reviews and optimizes AWS CloudFormation templates using production-grade patterns and validation practices.

Updated May 8, 2026
One-click install
npx skills add https://github.com/kiprotichgidii/agent-skills --skill cloudformation-best-practices-kiprotichgidii
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: cloudformation-best-practices
Source: https://github.com/kiprotichgidii/agent-skills/tree/main/skills/cloudformation-best-practices
Command: npx skills add https://github.com/kiprotichgidii/agent-skills --skill cloudformation-best-practices-kiprotichgidii

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing and maintaining CloudFormation templates often leads to hardcoded values, monolithic stacks, and deployment failures that are hard to debug. This Skill provides expert guidance for writing, reviewing, and optimizing CloudFormation templates so your infrastructure code is maintainable, parameterized, and safe to deploy. ## Core Features & Use Cases - Template Optimization: Enforces YAML best practices such as parameterization, Mappings, Conditions, and !Sub over !Join for cleaner templates. - Stateful Resource Protection: Applies DeletionPolicy: Retain and UpdateReplacePolicy on RDS, S3, and DynamoDB resources to prevent accidental data loss. - Troubleshooting Guidance: Diagnoses stack failures like UPDATE_ROLLBACK_FAILED and provides concrete recovery commands. - Use Case: You are reviewing a teammate's VPC template before deployment. Use this Skill to verify it uses parameters, exports outputs for cross-stack references, and passes cfn-lint and cfn-nag checks in CI. ## Quick Start Review my CloudFormation template for best practices and suggest improvements for production deployment.

Frequently Asked Questions about cloudformation-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write production-ready CloudFormation templates?▼

Use YAML with parameterized environment-specific values, Mappings for static lookups, and Conditions for multi-environment support. Add DeletionPolicy: Retain on stateful resources like RDS, S3, and DynamoDB, and validate with aws cloudformation validate-template before deploying.

How to reference resources across CloudFormation stacks?▼

Use Outputs with Export in the source stack and ImportValue in consuming stacks for cross-stack references. Name exports with !Sub and environment prefixes, such as ${Environment}-VpcId, to avoid collisions across environments.

Should I use CloudFormation or CDK and Terraform?▼

This Skill applies only to raw CloudFormation templates in YAML or JSON. If your team prefers CDK or Terraform for infrastructure definition, those tools generate or manage resources differently and this guidance does not apply.

How do I fix a stack stuck in UPDATE_ROLLBACK_FAILED?▼

Run continue-update-rollback with the --resources-to-skip flag for the failing resource to unblock the stack. After the stack stabilizes, fix the root cause of the failure and redeploy the corrected template.

What tools validate CloudFormation templates in CI pipelines?▼

Use cfn-lint to catch template syntax and best-practice violations, and cfn-nag to detect security issues like overly permissive rules. Run both in CI alongside aws cloudformation validate-template before any deployment.