CloudFormation Template Review Prompt
Review a CloudFormation (or CDK-synthesized) template for correctness, drift resistance, and safe updates — intrinsic functions, change-set surprises, deletion policies, and the resources that recreate when you least expect it.
- Target user
- AWS engineers reviewing CloudFormation/CDK stacks
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a principal AWS engineer who has watched CloudFormation stacks roll back at 2am because an "innocent" update replaced a resource.
I will provide:
- The template (YAML/JSON) or the CDK construct that synthesizes it
- What the stack manages and whether it holds stateful resources (RDS, EBS, S3 with data)
- Update history / the change we're about to make
Your job:
1. **Replacement audit** — go resource-by-resource and flag every property whose update causes **Replacement** vs **No interruption** (the dreaded RDS DBInstanceIdentifier, EC2 AvailabilityZone, S3 BucketName changes). This is the single most important review pass.
2. **DeletionPolicy & UpdateReplacePolicy** — every stateful resource (RDS, DynamoDB, S3, EBS) MUST have `DeletionPolicy: Retain` or `Snapshot` and a matching `UpdateReplacePolicy`. Flag any that don't.
3. **Intrinsic functions** — review `!Ref` vs `!GetAtt` correctness, `!Sub` over string concat, `!If`/`Conditions` clarity, and any `!ImportValue` cross-stack coupling that will make stacks impossible to delete in the wrong order.
4. **Parameters & defaults** — sane `AllowedValues`, `NoEcho` on secrets, and constraints that fail fast. Flag secrets passed as plain parameters (use Secrets Manager dynamic references `{{resolve:secretsmanager:...}}`).
5. **Drift** — which properties are commonly changed out-of-band in the console, how to detect drift (`detect-stack-drift`), and how to reconcile without a destructive update.
6. **Safe deploys** — always review via a **change set** before execute; use stack policies to deny updates to critical resources; enable termination protection on prod stacks.
7. **CDK note (if applicable)** — check the synthesized template, not just the L2 constructs; verify removal policies survive `cdk synth`.
Output as: (a) a replacement-risk table (resource, property, action), (b) missing DeletionPolicy findings, (c) intrinsic-function/secret fixes, (d) a pre-deploy change-set + drift checklist, (e) the single change most likely to cause an outage.
Bias toward: assume every update is a replacement until proven otherwise, and never let a data-bearing resource be deletable.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
AWS CDK Escape Hatches & L1 Override Prompt
Use CDK escape hatches (addPropertyOverride, addOverride, addDeletionOverride, and L2-to-L1 access) to set properties the L2 construct does not expose, without forking constructs or dropping to raw CloudFormation.
-
CloudFormation Change Set Review Prompt
Review a CloudFormation change set before you execute it — classifying every action as add, modify, or replace, flagging the replacements that destroy data, and turning a raw describe-change-set JSON into a go/no-go deployment decision.
-
AWS CDK Aspects Compliance Enforcement Prompt
Write AWS CDK Aspects that visit the construct tree to enforce tagging, encryption, and security rules across all stacks at synth time.
-
CloudFormation Hooks Pre-Provision Guardrails Prompt
Author a CloudFormation Hook that validates resource configurations pre-provision and blocks non-compliant stacks across an account.
More Infrastructure as Code prompts & error guides
Browse every Infrastructure as Code prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.