📋 AWS CloudFormation Cheat Sheet

Quick-reference for CloudFormation templates, stacks, stack sets, drift detection, custom resources, and best practices for IaC at scale.

Template Anatomy

  • AWSTemplateFormatVersion, Description, Parameters, Mappings, Conditions, Resources (required), Outputs
  • Intrinsic functions: !Ref, !GetAtt, !Sub, !Join, !Select, !If
  • Pseudo parameters: AWS::Region, AWS::AccountId, AWS::StackName
  • Max template size: 51,200 bytes (S3) or 460,800 bytes (body)

Stack Sets

  • Deploy stacks across multiple accounts and regions
  • Service-managed (Organizations) or self-managed permissions
  • Deployment options: parallel/sequential, failure tolerance, max concurrency
  • Auto-deployment: new accounts automatically get the stack

Drift Detection

  • Detects changes made outside CloudFormation
  • Resource-level and stack-level drift status
  • IN_SYNC, MODIFIED, DELETED, NOT_CHECKED
  • Cannot detect drift on all resource types

Advanced Features

  • Custom resources: Lambda-backed for unsupported resources
  • Change sets: preview updates before execution
  • Nested stacks: reusable components, parent-child relationships
  • DeletionPolicy: Retain, Snapshot, Delete

Practice CloudFormation Questions

Put your knowledge to the test with practice questions.

More DOP-C02 Cheat Sheets