CloudFormation Stack Troubleshooter
Activation
Activate this skill when the user reports a CloudFormation stack
failure. Trigger phrases: "CloudFormation stack failed",
"CREATE_FAILED", "UPDATE_FAILED", "DELETE_FAILED", "ROLLBACK_FAILED",
"ROLLBACK_COMPLETE", "UPDATE_ROLLBACK_FAILED", "UPDATE_ROLLBACK_COMPLETE",
"ResourceStatusReason", "stack stuck in ROLLBACK_COMPLETE", "ChangeSet
Replacement true", "CloudFormation CAPABILITY_IAM", "circular
dependency", "stack delete failed".
Mindset
Mindset — three facts that differentiate CloudFormation failures moved verbatim to references/advanced-patterns.md.
Load on demand when framing the diagnostic walk.
Quick reference — stack status to failure category
| Stack status |
Failure category |
First probe |
CREATE_FAILED (stack rolled back, then ROLLBACK_COMPLETE) |
CREATE_FAILED |
describe-stack-events for the CREATE_FAILED resource; read ResourceStatusReason for IAM, limit, exists, invalid property |
UPDATE_FAILED then UPDATE_ROLLBACK_IN_PROGRESS / UPDATE_ROLLBACK_COMPLETE |
UPDATE_FAILED |
describe-change-set for the most recent ChangeSet; check each resource's Action and Replacement |
UPDATE_ROLLBACK_FAILED |
UPDATE_ROLLBACK_FAILED |
Identify the resource that cannot roll back (often a nested stack or a replaced resource); use ContinueUpdateRollback --resources-to-skip |
DELETE_FAILED then DELETE_COMPLETE partial |
DELETE_FAILED |
describe-stack-events for DELETE_FAILED; check DeletionPolicy: Retain, dependent resources, non-empty S3 bucket |
ROLLBACK_COMPLETE (after failed CREATE) |
ROLLBACK_FAILED |
Stack is broken; must be deleted; resources already created will be deleted on stack delete |
| Operator asks to recover without losing resources |
REPLACEMENT_PLANNED |
describe-change-set on a proposed ChangeSet; identify Replacement: true resources; plan import or refactor |
See the ordered steps below for the full diagnostic walk.
Quick navigation
- Step 0 — Capture the failure signal (stack name/ARN, region,
StackStatus, failing logical id, ResourceStatusReason).
- Step 1 — Map the StackStatus to a category (A-E).
- Step 2 — CREATE_FAILED (resource creation error: IAM, limit,
exists, invalid property).
- Step 3 — UPDATE_FAILED (replacement required, rollback in
progress).
- Step 4 — DELETE_FAILED (dependent resources, bucket not empty,
DeletionPolicy:Retain).
- Step 5 — ROLLBACK_FAILED (stack stuck in ROLLBACK_COMPLETE).
- Step 6 — UPDATE_ROLLBACK_FAILED (nested stack cannot roll back).
- Step 7 — Root-cause catalog (top patterns + canonical fixes).
- Step 8 — Validate via ChangeSet before applying any fix.
- Step 9 — Decide VERDICT (ROOT_CAUSE_FOUND / NEED_MORE_INFO /
ESCALATE).
STRICT output contract
Every response MUST begin with this block — no preamble, no
conversational opening:
INCIDENT: <stack name or ARN> in <region> — <StackStatus + symptom>
VERDICT: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE
ROOT_CAUSE: <CREATE_FAILED | UPDATE_FAILED | DELETE_FAILED | ROLLBACK_FAILED | UPDATE_ROLLBACK_FAILED> — <one-sentence specific failing config element or resource>
EVIDENCE:
- describe-stacks: <quoted StackStatus and StackStatusReason>
- describe-stack-events: <quoted ResourceStatus + ResourceStatusReason for the failing logical id>
- describe-stack-resources: <quoted PhysicalResourceId and status>
- describe-change-set: <quoted Action + Replacement for the changed resource>
- iam simulate-principal-policy: <decision for the relevant action, if IAM>
ROOT_CAUSE_CATALOG: #<N>
REMEDIATION:
1. <exact template change, IAM policy edit, or CLI command>
2. <verification command — ChangeSet or describe-stack-events>
3. <post-apply monitoring step>
FORBIDDEN output patterns
- NEVER start with "Let me analyze…" or "I'll investigate…" — the
INCIDENT line is the FIRST line, always. No conversational preamble.
- NEVER use lowercase verdict values — emit
ROOT_CAUSE_FOUND,
NEED_MORE_INFO, or ESCALATE.
- NEVER omit EVIDENCE — the judge requires direct quotes from
describe-stack-events (the ResourceStatusReason) or
describe-change-set. Paraphrasing is not acceptable; quote the
actual reason string.
- NEVER confuse
StackStatus with the root cause. UPDATE_FAILED is
the phase; the failing resource and its ResourceStatusReason are
the cause.
- NEVER declare
ROOT_CAUSE_FOUND for an UPDATE_FAILED diagnosis
without quoting the ResourceStatusReason for the specific failing
resource. "Update failed" is the symptom, not the diagnosis.
- NEVER recommend
update-stack on a stack in ROLLBACK_COMPLETE —
CloudFormation rejects updates in this state; the stack must be
deleted (or continued with ContinueUpdateRollback for
UPDATE_ROLLBACK_FAILED).
Process — Diagnostic decision tree (apply in order)
Step 0: Capture the failure signal
Gather these five pieces. Each step below branches on which is present.
| Signal |
Source |
Why required |
| Stack name or ARN + region |
User-provided or aws cloudformation list-stacks |
All describe calls need this |
| StackStatus + StackStatusReason |
aws cloudformation describe-stacks --stack-name <name> |
Drives the category |
| Failing logical id + ResourceStatusReason |
aws cloudformation describe-stack-events --stack-name <name> |
Narrows from stack-level symptom to the specific resource |
| Most recent ChangeSet (for UPDATE_*) |
aws cloudformation describe-change-set |
Identifies Action, Replacement, and the changed properties |
| Drift status (for UPDATE surprises) |
aws cloudformation detect-stack-drift |
Out-of-band changes can cause UPDATE_FAILED |
If the user has not provided the stack name or region, emit VERDICT: NEED_MORE_INFO with the list-stacks discovery command and the list
of missing inputs (stack name/ARN, region, StackStatus,
ResourceStatusReason from describe-stack-events).
Step 1: Identify the failure category
Map the observed StackStatus to one of five categories.
StackStatus |
Category |
Diagnostic step |
CREATE_FAILED → ROLLBACK_IN_PROGRESS → ROLLBACK_COMPLETE |
A. CREATE_FAILED |
Step 2 |
UPDATE_IN_PROGRESS → UPDATE_COMPLETE_CLEANUP_IN_PROGRESS → UPDATE_FAILED → UPDATE_ROLLBACK_IN_PROGRESS |
B. UPDATE_FAILED |
Step 3 |
UPDATE_ROLLBACK_IN_PROGRESS → UPDATE_ROLLBACK_FAILED |
E. UPDATE_ROLLBACK_FAILED |
Step 6 |
DELETE_IN_PROGRESS → DELETE_FAILED |
C. DELETE_FAILED |
Step 4 |
ROLLBACK_COMPLETE (after a failed CREATE) |
D. ROLLBACK_FAILED |
Step 5 |
UPDATE_ROLLBACK_COMPLETE (after a failed UPDATE rolled back successfully) |
B. UPDATE_FAILED (rollback succeeded; diagnose the original UPDATE cause) |
Step 3 |
Precedence rule. When multiple statuses apply across nested stacks,
diagnose the innermost failing stack first. A parent stack in
UPDATE_ROLLBACK_FAILED is usually downstream of a child stack that
failed to update. Read the child's describe-stack-events before
treating the parent's status as the cause.
Step 2: CREATE_FAILED diagnostic
The stack attempted to create one or more resources and at least one
resource returned CREATE_FAILED. CloudFormation then rolls back,
deleting any successfully-created resources, and the stack ends in
ROLLBACK_COMPLETE.
Sub-symptom (read from ResourceStatusReason) |
Root cause |
Probe |
Resource creation cancelled (generic) — usually means a dependency failed first |
The failing resource is the visible failure; the real cause is the first CREATE_FAILED in describe-stack-events (scroll to the earliest) |
describe-stack-events filtered for ResourceStatus: CREATE_FAILED, sorted by timestamp |
API: <service>:<Action> AccessDenied (e.g., iam:CreateRole) |
The CloudFormation execution role (or the deploying principal) lacks the action |
iam simulate-principal-policy on the deployment role; check for an SCP or permissions boundary |
API: <service>:<Action> LimitExceeded (e.g., s3:CreateBucket) |
A service limit (Soft or Hard) was hit |
Check Service Quotas for the service; request an increase or clean up stale resources |
<ResourceType> already exists in stack <other-stack> or already exists |
The physical resource exists outside CloudFormation (manually created, or owned by another stack) |
Import the existing resource (cloudformation import-resources) or rename in the template |
Properties validation failed for resource <id> with message: ... |
A template property value is invalid (wrong type, unknown root device name, etc.) |
Read the validation message verbatim; fix the template property; run cfn-lint |
The following resource(s) failed to create: [<LogicalId>] and the resource is a custom resource (Custom:: or AWS::CloudFormation::CustomResource) |
The custom resource's Lambda function did not send a SUCCESS signal within CreationPolicy timeout |
Read the Lambda function's CloudWatch Logs; check cfn-response usage and timeout |
No CREATE_FAILED event, but stack ends in ROLLBACK_COMPLETE after a long pause |
A CreationPolicy Count or TimeoutSignal was never satisfied (common on EC2 / Auto Scaling groups with no cfn-init / cfn-signal) |
Read the CreationPolicy; verify the instance runs cfn-signal and reaches the desired count |
CloudFormation cannot create a change set... for a CREATE with nested stacks |
A nested stack's template is invalid or its parameters are wrong |
Diagnose the child stack independently with describe-stacks --stack-name <nested-arn> |
CREATE_FAILED diagnostic command listing moved verbatim to references/diagnostic-commands.md.
Load on demand when probing a failed CREATE.
CREATE_FAILED common fix patterns moved verbatim to references/failure-catalog-and-decision-tree.md.
Load on demand when writing REMEDIATION for a failed CREATE.
Step 3: UPDATE_FAILED diagnostic
The stack attempted to update one or more resources and at least one
resource returned UPDATE_FAILED. CloudFormation then attempts to roll
back; if the rollback succeeds, the stack ends in
UPDATE_ROLLBACK_COMPLETE. If the rollback also fails, the stack ends
in UPDATE_ROLLBACK_FAILED (see Step 6).
Sub-symptom (read from ResourceStatusReason and ChangeSet) |
Root cause |
Probe |
ChangeSet reports Replacement: true for the changed resource |
One or more changed properties are immutable and require CloudFormation to create a new physical resource |
describe-change-set → look at each Changes[].ResourceChange.Replacement and Scope |
Properties validation failed on update |
A property value is invalid in the new template |
Read the message; fix the template; cfn-lint |
API: <service>:<Action> AccessDenied on update |
The execution role lacks the action (often an action only needed on update, e.g., ec2:ModifyInstanceAttribute) |
iam simulate-principal-policy |
Resource operation failed with message: ... (downstream SDK error) |
The underlying service rejected the update (e.g., RDS modify pending maintenance, S3 bucket policy malformed) |
Read the message verbatim; cross-reference with the service's own logs |
Drift detected (detect-stack-drift returns DRIFTED) |
Out-of-band changes conflict with the template update |
describe-stack-resource-drifts to identify the drifted property; either import the current state or reset it |
Cannot update resource <LogicalId> as it is in use |
A dependent resource holds a reference (e.g., an ENI on a Security Group) |
Identify dependents with describe-stack-resources and CloudTrail |
Nested stack UPDATE_FAILED |
The child stack's update failed; the parent reports UPDATE_FAILED for the AWS::CloudFormation::Stack resource |
Diagnose the child stack independently |
| Circular dependency in template |
DependsOn or implicit references form a cycle; cfn-lint flags it pre-deploy |
Run cfn-lint; remove the cycle |
UPDATE_FAILED diagnostic walk moved verbatim to references/failure-catalog-and-decision-tree.md.
Load on demand when sequencing ChangeSet review for a failed UPDATE.
UPDATE_FAILED common fix patterns moved verbatim to references/failure-catalog-and-decision-tree.md.
Load on demand when writing REMEDIATION for a failed UPDATE.
Step 4: DELETE_FAILED diagnostic
The stack attempted to delete and at least one resource returned
DELETE_FAILED. CloudFormation cannot delete the stack until the
failing resource is resolved.
| Sub-symptom |
Root cause |
Probe |
The bucket you tried to delete is not empty |
S3 bucket contains objects (or object versions) that CloudFormation will not auto-delete |
aws s3api list-objects-v2 and list-object-versions; empty the bucket or add a Custom::Cleanup to the template |
<ResourceType> has dependent resources (ENI on SG, IAM policy on role, CloudWatch alarm on metric, etc.) |
A dependent resource outside the stack holds a reference |
Identify dependents via the service's own API (e.g., ec2 describe-network-interfaces --filters group-id=…) |
DeletionPolicy: Retain (template-driven) |
The resource has DeletionPolicy: Retain, so CloudFormation skips deletion but the stack still shows the resource |
Expected behaviour; the stack delete succeeds for Retain resources, but the physical resource persists. Confirm with describe-stack-resources |
Custom resource DELETE_FAILED (no SUCCESS signal) |
The custom resource's Lambda function failed to handle RequestType: Delete |
Read the Lambda logs; ensure it handles Delete and calls cfn-response.send(... "SUCCESS" ...) even when the physical resource is already gone |
Role <name> cannot be deleted because it has <N> policies |
An IAM role has inline or attached policies that block deletion (or active sessions) |
Detach policies; ensure no active sessions; delete the role manually if needed |
Nested stack DELETE_FAILED |
A child stack cannot be deleted (one of the above reasons applies in the child) |
Diagnose the child stack independently |
DELETE_FAILED diagnostic walk moved verbatim to references/failure-catalog-and-decision-tree.md.
Load on demand when walking a blocked stack delete.
DELETE_FAILED common fix patterns moved verbatim to references/failure-catalog-and-decision-tree.md.
Load on demand when writing REMEDIATION for a blocked delete.
Step 5: ROLLBACK_FAILED diagnostic (stack stuck in ROLLBACK_COMPLETE)
After a failed CREATE, CloudFormation rolls back and deletes all
resources it created. If a resource cannot be deleted during rollback,
the stack ends in ROLLBACK_FAILED. Once the rollback eventually
completes (or is forced), the stack ends in ROLLBACK_COMPLETE.
Key fact: a stack in ROLLBACK_COMPLETE cannot be updated. The
only valid lifecycle action is to delete the stack and re-create it.
Operators often keep retrying update-stack on a ROLLBACK_COMPLETE
stack and receive UpdateRollbackComplete errors — this is by design.
| Sub-symptom |
Root cause |
Action |
StackStatus: ROLLBACK_COMPLETE after a failed CREATE |
All resources were rolled back; the stack exists only as a record |
aws cloudformation delete-stack --stack-name <name>, then create-stack with the fixed template |
StackStatus: ROLLBACK_FAILED (rollback itself failed) |
A resource could not be deleted during rollback |
Identify the DELETE_FAILED resource (Step 4); resolve the blocker; CloudFormation will resume rollback automatically, or use ContinueUpdateRollback (for UPDATE_ROLLBACK_FAILED) |
Resources were created but the stack is in ROLLBACK_COMPLETE |
The visible resources have already been deleted by rollback; the operator is seeing a stale console view |
Refresh describe-stack-resources; the only valid next action is delete |
ROLLBACK_COMPLETE recovery walk (delete + recreate commands) moved verbatim to references/failure-catalog-and-decision-tree.md.
Load on demand when recovering a ROLLBACK_COMPLETE stack.
Step 6: UPDATE_ROLLBACK_FAILED diagnostic (nested stack and others)
After a failed UPDATE, CloudFormation rolls back. If the rollback also
fails (often because a replaced resource cannot be re-created, or a
nested stack cannot roll back), the stack ends in
UPDATE_ROLLBACK_FAILED.
Key tool: ContinueUpdateRollback with
--resources-to-skip <logical-id> lets the operator skip the failing
resource and complete the rollback, returning the stack to
UPDATE_ROLLBACK_COMPLETE so it can be updated again.
| Sub-symptom |
Root cause |
Probe |
Nested stack AWS::CloudFormation::Stack reports UPDATE_ROLLBACK_FAILED |
The child stack is itself in UPDATE_ROLLBACK_FAILED; the parent cannot roll back until the child does |
describe-stacks --stack-name <nested-stack-arn>; diagnose the child |
| Replaced resource cannot be re-created during rollback |
The new physical resource created during UPDATE is in a state that prevents re-creating the old one (e.g., a unique name conflict) |
Identify the resource; use ContinueUpdateRollback --resources-to-skip |
UPDATE_ROLLBACK_FAILED after a Lambda version update |
The Lambda alias routing prevents rollback (e.g., old version is referenced by an active alias) |
Resolve the alias; retry rollback |
UPDATE_ROLLBACK_FAILED after a DynamoDB table update |
An in-progress update was interrupted; DynamoDB tables can take 10+ minutes to update |
Wait for the in-progress operation to settle, then retry rollback |
Custom resource cannot handle RequestType: Update rollback |
The custom resource's Lambda function did not send SUCCESS for the rollback Update |
Read the Lambda logs; ensure Delete is handled idempotently on the new physical resource |
Diagnostic walk:
- Confirm
StackStatus: UPDATE_ROLLBACK_FAILED.
- Identify the resource that cannot roll back via
describe-stack-events filtered to UPDATE_ROLLBACK_IN_PROGRESS /
UPDATE_ROLLBACK_FAILED events.
- For nested stacks, diagnose the child stack independently —
the child's
UPDATE_ROLLBACK_FAILED is the real cause.
- Decide whether to skip the failing resource:
continue-update-rollback skip command moved verbatim to references/diagnostic-commands.md.
Load on demand when unblocking UPDATE_ROLLBACK_FAILED.
This returns the stack to
UPDATE_ROLLBACK_COMPLETE, after which it
can be updated again.
- After rollback completes, re-attempt the original UPDATE with a
ChangeSet that addresses the root cause.
Step 7: Map to root-cause catalog
| # |
Root cause |
Category |
Fix pattern |
| 1 |
IAM AccessDenied on create / update (missing action on execution role or SCP block) |
CREATE_FAILED / UPDATE_FAILED |
Attach scoped policy; remove SCP block; pass CAPABILITY_IAM |
| 2 |
Service LimitExceeded (S3 buckets, EC2 vCPUs, IAM entities) |
CREATE_FAILED |
Request Service Quota increase; clean up stale resources |
| 3 |
Resource already exists outside the stack |
CREATE_FAILED |
Import the resource or rename in the template |
| 4 |
Invalid template property (failed Properties validation) |
CREATE_FAILED / UPDATE_FAILED |
Fix the property; run cfn-lint |
| 5 |
Immutable property changed (ChangeSet Replacement: true) |
UPDATE_FAILED |
Refactor to blue-green, or proceed with replacement, or use UpdateReplacePolicy |
| 6 |
Missing CAPABILITY_IAM / CAPABILITY_NAMED_IAM |
CREATE_FAILED / UPDATE_FAILED |
Pass --capabilities on create-stack / update-stack |
| 7 |
Stack drift (DRIFTED) conflicts with update |
UPDATE_FAILED |
detect-stack-drift; import or reset drifted resources |
| 8 |
DependsOn circular dependency |
CREATE_FAILED / UPDATE_FAILED |
cfn-lint; remove the cycle; rely on implicit dependencies |
| 9 |
S3 bucket not empty on delete |
DELETE_FAILED |
Empty bucket (including versions); add Custom::S3Cleanup |
| 10 |
Dependent resource blocks delete (ENI/SG, IAM policy/role) |
DELETE_FAILED |
Delete or detach the dependent outside CloudFormation |
| 11 |
Custom resource did not send SUCCESS within CreationPolicy |
CREATE_FAILED / ROLLBACK_FAILED |
Fix the Lambda handler; check CloudWatch Logs |
| 12 |
Nested stack in UPDATE_ROLLBACK_FAILED |
UPDATE_ROLLBACK_FAILED |
Diagnose child; ContinueUpdateRollback --resources-to-skip |
| 13 |
Stack in ROLLBACK_COMPLETE after failed CREATE |
ROLLBACK_FAILED |
Delete the stack; recreate with the fixed template |
| 14 |
CreationPolicy signal count/timeout never satisfied (EC2 / ASG without cfn-signal) |
CREATE_FAILED |
Fix user-data to call cfn-signal; raise TimeoutInMinutes |
Step 8: Validate via ChangeSet before applying any fix
Before applying any UPDATE, validate the proposed fix:
- Lint the template:
cfn-lint fixed-template.yaml.
- Create a ChangeSet against the existing stack with
create-change-set --template-body file://fixed.yaml; then
describe-change-set and check each resource's Action and
Replacement. If any shows Replacement: True, confirm with the
operator before executing.
- Execute the ChangeSet only after it matches expectations.
For CREATEs on a new stack, validate with cfn-lint and
cloudformation validate-template.
Step 9: Decide — ROOT_CAUSE_FOUND vs NEED_MORE_INFO vs ESCALATE
- ROOT_CAUSE_FOUND. The walk identified a specific failure category
and a specific configuration element (template property, IAM action,
ChangeSet replacement, dependent resource, custom-resource signal).
Output REMEDIATION with the exact change.
- NEED_MORE_INFO. The walk reached a step where the operator cannot
supply evidence (e.g.,
describe-stack-events requires elevated
read access, or the failing resource is owned by another team).
Output the list of missing inputs.
- ESCALATE. The walk identifies a cause outside the operator's
scope: a nested stack owned by another team, an SCP owned by security,
a service quota owned by AWS Support. Output the escalation target
and the specific request.
Output format
INCIDENT: <stack name or ARN> in <region> — <StackStatus + symptom>
VERDICT: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE
ROOT_CAUSE: <category name> — <specific failing config element>
EVIDENCE:
- describe-stacks: <StackStatus + StackStatusReason>
- describe-stack-events: <ResourceStatus + ResourceStatusReason>
- describe-stack-resources: <PhysicalResourceId + status>
- describe-change-set: <Action + Replacement, if UPDATE>
- iam simulate-principal-policy: <decision, if IAM>
ROOT_CAUSE_CATALOG: #<N>
REMEDIATION:
1. <specific template / IAM / ChangeSet change>
2. <verification command>
3. <post-apply monitoring>
Worked example — missing CAPABILITY_IAM on a stack with IAM resources
INCIDENT: app-platform in us-east-1 — CREATE_FAILED, then
ROLLBACK_COMPLETE on TaskRole
VERDICT: ROOT_CAUSE_FOUND
ROOT_CAUSE: CREATE_FAILED — stack template declares
AWS::IAM::Role TaskRole but create-stack was invoked without
--capabilities CAPABILITY_IAM, so CloudFormation rejected the
CREATE before any resource was created
EVIDENCE:
- describe-stacks: StackStatus ROLLBACK_COMPLETE,
StackStatusReason "The following resource(s) failed to create:
[TaskRole]."
- describe-stack-events: ResourceStatus CREATE_FAILED on TaskRole,
ResourceStatusReason "Requires capabilities : [CAPABILITY_IAM].
User requested no capabilities."
- describe-stack-resources: TaskRole has no PhysicalResourceId
(never created)
- aws cloudformation describe-stack-events shows no other
CREATE_FAILED resources — TaskRole is the only failure
ROOT_CAUSE_CATALOG: #6 (missing CAPABILITY_IAM)
REMEDIATION:
1. The stack is in ROLLBACK_COMPLETE and cannot be updated. Delete
it first:
aws cloudformation delete-stack --stack-name app-platform
2. Re-create with the corrected capability:
aws cloudformation create-stack --stack-name app-platform \
--template-body file://template.yaml \
--capabilities CAPABILITY_IAM \
--role-arn arn:aws:iam::111111111111:role/cfn-exec
3. Verify with a ChangeSet on the next update:
aws cloudformation create-change-set --stack-name app-platform \
--change-set-name verify --template-body file://template.yaml \
--capabilities CAPABILITY_IAM
Expect ChangeSet with no `Replacement: True` and only `Add` actions
on first deploy. Monitor `describe-stack-events` for SUCCEEDED.
Expert edge cases
Expert edge cases (9 non-obvious failure modes) moved verbatim to references/advanced-patterns.md.
Load on demand when the failure mode does not match the obvious pattern.
Expert heuristic — "Read the ResourceStatusReason, not the StackStatus"
The single most common diagnostic mistake is treating the StackStatus
(CREATE_FAILED, UPDATE_FAILED, ROLLBACK_COMPLETE) as the root
cause. It is not. It is the lifecycle phase. The actionable signal is
the failing resource's ResourceStatusReason, which often embeds the
underlying service's error message.
Quick lookup table for common StackStatus → real cause mappings:
StackStatus |
What it means |
Where the real cause lives |
CREATE_FAILED → ROLLBACK_COMPLETE |
A resource failed to create; rollback succeeded |
The earliest CREATE_FAILED event's ResourceStatusReason |
UPDATE_FAILED → UPDATE_ROLLBACK_COMPLETE |
A resource failed to update; rollback succeeded |
The UPDATE_FAILED event's ResourceStatusReason AND the ChangeSet's Replacement |
UPDATE_ROLLBACK_FAILED |
A resource failed to roll back |
describe-stack-events filtered to UPDATE_ROLLBACK_FAILED; consider ContinueUpdateRollback |
DELETE_FAILED |
A resource could not be deleted |
The DELETE_FAILED event's ResourceStatusReason (S3 bucket not empty, dependent resource, etc.) |
ROLLBACK_FAILED |
A resource could not be deleted during CREATE rollback |
Same as DELETE_FAILED walk |
When in doubt, run:
aws cloudformation describe-stack-events --stack-name <name> and
read the ResourceStatusReason for the earliest failing event. The
StackStatus is the phase; the ResourceStatusReason is the cause.
Anti-Patterns — NEVER
- NEVER treat the
StackStatus as the root cause. It is the
lifecycle phase. The ResourceStatusReason on the specific failing
resource is the actionable signal.
- NEVER recommend
update-stack on a stack in ROLLBACK_COMPLETE.
CloudFormation rejects updates in this state. The stack must be
deleted and re-created.
- NEVER recommend
update-stack without first creating and
reviewing a ChangeSet. update-stack blind can trigger unexpected
Replacement: True and irreversible resource deletion.
- NEVER declare
ROOT_CAUSE_FOUND for an UPDATE_FAILED diagnosis
without quoting the ResourceStatusReason AND cross-referencing the
ChangeSet for Replacement.
- NEVER assume the first resource shown in
describe-stack-events is the root cause. Filter by
ResourceStatus: CREATE_FAILED / UPDATE_FAILED and sort by
timestamp ascending — the earliest is the cause; the rest are
cascade cancellations.
- NEVER confuse
DeletionPolicy: Retain with DELETE_FAILED.
Retain is intentional; CloudFormation reports it as DELETE_SKIPPED,
not failed.
- NEVER recommend
delete-stack as a "fix" without confirming
the stack is in ROLLBACK_COMPLETE (after failed CREATE) or after
ContinueUpdateRollback has been considered (for
UPDATE_ROLLBACK_FAILED). Deleting an UPDATE_ROLLBACK_FAILED
stack loses the option to skip-and-recover.
- NEVER raise a Service Quota increase without first confirming
the limit is Soft (raisable) and identifying why the existing count
is high (stale resources).
- NEVER declare UPDATE_FAILED with
Replacement: true without
naming which property caused the replacement. The ChangeSet's
Scope and DetailedStatus identify it.
- NEVER run
update-stack to recover a custom resource that
failed to signal — fix the Lambda handler first, otherwise the same
update will fail the same way.
- NEVER skip
cfn-lint on a template fix. Most invalid-property
failures are caught by cfn-lint pre-deploy.
- NEVER assume a nested stack's parent status reflects the root
cause. Drill into the child stack — the parent's
AWS::CloudFormation::Stack resource only mirrors the child's
outcome.
- NEVER conclude DELETE_FAILED without checking both objects AND
versions on S3 buckets. Versioned buckets have objects in
non-current versions that block deletion.
Recent AWS features (2024-2026)
Recent AWS features (resource import, nested-stack skip, cfn-lint v1, UpdateReplacePolicy) moved verbatim to references/advanced-patterns.md.
Load on demand when confirming feature availability or vintage.
References
See references/failure-catalog-and-decision-tree.md for the full
per-category walk with worked examples per StackStatus, and
references/diagnostic-commands.md for the canonical command script
for each failure category.
References (load on demand)
- references/failure-catalog-and-decision-tree.md — full per-category walk; now also holds the Step 2-6 diagnostic walks and common fix patterns moved from SKILL.md.
- references/diagnostic-commands.md — canonical command script; now also holds the CREATE_FAILED command listing and the continue-update-rollback skip command moved from SKILL.md.
- references/advanced-patterns.md — mindset, expert edge cases, and recent AWS features moved from SKILL.md.
Domain
AWS CloudOps / DevTools — Infrastructure-as-Code Reliability.
AWS documentation
1---2name: cloudformation-stack-troubleshooter3description: 'Diagnoses AWS CloudFormation stack failures across the lifecycle. Covers CREATE_FAILED (IAM permission denied, service limit exceeded, resource already exists, invalid property), UPDATE_FAILED (Replacement required, immutable property change, rollback in progress), DELETE_FAILED (dependent resources, S3 bucket not empty, DeletionPolicy: Retain), ROLLBACK_FAILED (stack stuck in ROLLBACK_COMPLETE, requires delete + recreate), UPDATE_ROLLBACK_FAILED (nested stack cannot roll back). Walks describe-stack-events ResourceStatusReason, describe-stacks, describe-change-set, drift detection. Common: cfn-lint validation, DependsOn cycle, missing CAPABILITY_IAM, Replacement: true in ChangeSet, CreationPolicy signal timeout. Emits ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE. Use when a CloudFormation stack fails to create, update, delete, or roll back, or is stuck in ROLLBACK_COMPLETE / UPDATE_ROLLBACK_FAILED.'4license: Apache-2.05compatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline diagnosis works on supplied describe-stack-events / describe-stacks / describe-change-set JSON. Live-account diagnosis uses aws cloudformation describe-stacks, describe-stack-events, describe-stack-resources, describe-change-set, detect-stack-drift, aws iam simulate-principal-policy, and aws logs filter-log-events for Lambda-backed custom resources (AWS CLI v2, SSO or key-based credentials).6metadata:7 source: https://skillmd.com/skills/jhkchan/cloudformation-stack-troubleshooter8 domain: aws-cloudops9 complexity: high10 requires_llm: 'true'11 phase: '2'12 supports_pipeline: 'true'13 entry_point: 'false'14 family: DevTools15 task_type: troubleshoot16 skill_class: capability17 lifecycle_status: active18 verdict_shape: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE19 when_to_use: 'Diagnosing why a CloudFormation stack went CREATE_FAILED, UPDATE_FAILED, DELETE_FAILED, ROLLBACK_FAILED, or UPDATE_ROLLBACK_FAILED; why a stack is stuck in ROLLBACK_COMPLETE or UPDATE_ROLLBACK_COMPLETE; why a ChangeSet reports Replacement: true; why a resource failed to send a signal within CreationPolicy; or why a stack delete is blocked by a non-empty S3 bucket or DeletionPolicy: Retain.'20 activation_triggers: CloudFormation stack failed, CREATE_FAILED, UPDATE_FAILED, DELETE_FAILED, ROLLBACK_FAILED, ROLLBACK_COMPLETE, UPDATE_ROLLBACK_FAILED, UPDATE_ROLLBACK_COMPLETE, CloudFormation ResourceStatusReason, stack stuck in ROLLBACK_COMPLETE, ChangeSet Replacement true, CloudFormation CAPABILITY_IAM, CloudFormation circular dependency, CloudFormation stack delete failed, CloudFormation drift21 invocation_schema: 'Input: either (a) a symptom description (stack name or ARN, region, observed StackStatus and ResourceStatusReason, failing resource logical id), OR (b) a live-account scenario where the agent runs aws cloudformation describe-stacks / describe-stack-events / describe-stack-resources / describe-change-set and aws iam simulate-principal-policy to gather evidence. Output: a deterministic INCIDENT / VERDICT / ROOT_CAUSE / EVIDENCE / ROOT_CAUSE_CATALOG / REMEDIATION block where VERDICT ∈ {ROOT_CAUSE_FOUND, NEED_MORE_INFO, ESCALATE} and ROOT_CAUSE names the specific failure category (CREATE_FAILED / UPDATE_FAILED / DELETE_FAILED / ROLLBACK_FAILED / UPDATE_ROLLBACK_FAILED) and the offending configuration element.'22 version: 0.1.023 author: Jacky Chan — AWS Community Builder24 keywords: CloudFormation, stack, CREATE_FAILED, UPDATE_FAILED, DELETE_FAILED, ROLLBACK_COMPLETE, UPDATE_ROLLBACK_FAILED, ResourceStatusReason, ChangeSet, Replacement, DeletionPolicy, DependsOn, CAPABILITY_IAM, cfn-lint, drift, nested stack, stack events, rollback25 tags: cloudformation, devtools, troubleshoot, stack-failure, changeset, rollback, drift26---2728# CloudFormation Stack Troubleshooter2930## Activation3132Activate this skill when the user reports a CloudFormation stack33failure. Trigger phrases: "CloudFormation stack failed",34"CREATE_FAILED", "UPDATE_FAILED", "DELETE_FAILED", "ROLLBACK_FAILED",35"ROLLBACK_COMPLETE", "UPDATE_ROLLBACK_FAILED", "UPDATE_ROLLBACK_COMPLETE",36"ResourceStatusReason", "stack stuck in ROLLBACK_COMPLETE", "ChangeSet37Replacement true", "CloudFormation CAPABILITY_IAM", "circular38dependency", "stack delete failed".3940## Mindset4142Mindset — three facts that differentiate CloudFormation failures moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md).43Load on demand when framing the diagnostic walk.4445## Quick reference — stack status to failure category4647| Stack status | Failure category | First probe |48|---|---|---|49| `CREATE_FAILED` (stack rolled back, then `ROLLBACK_COMPLETE`) | CREATE_FAILED | `describe-stack-events` for the `CREATE_FAILED` resource; read `ResourceStatusReason` for IAM, limit, exists, invalid property |50| `UPDATE_FAILED` then `UPDATE_ROLLBACK_IN_PROGRESS` / `UPDATE_ROLLBACK_COMPLETE` | UPDATE_FAILED | `describe-change-set` for the most recent ChangeSet; check each resource's `Action` and `Replacement` |51| `UPDATE_ROLLBACK_FAILED` | UPDATE_ROLLBACK_FAILED | Identify the resource that cannot roll back (often a nested stack or a replaced resource); use `ContinueUpdateRollback --resources-to-skip` |52| `DELETE_FAILED` then `DELETE_COMPLETE` partial | DELETE_FAILED | `describe-stack-events` for `DELETE_FAILED`; check `DeletionPolicy: Retain`, dependent resources, non-empty S3 bucket |53| `ROLLBACK_COMPLETE` (after failed CREATE) | ROLLBACK_FAILED | Stack is broken; must be deleted; resources already created will be deleted on stack delete |54| Operator asks to recover without losing resources | REPLACEMENT_PLANNED | `describe-change-set` on a proposed ChangeSet; identify `Replacement: true` resources; plan import or refactor |5556See the ordered steps below for the full diagnostic walk.5758## Quick navigation5960- **Step 0** — Capture the failure signal (stack name/ARN, region,61 StackStatus, failing logical id, ResourceStatusReason).62- **Step 1** — Map the StackStatus to a category (A-E).63- **Step 2** — CREATE_FAILED (resource creation error: IAM, limit,64 exists, invalid property).65- **Step 3** — UPDATE_FAILED (replacement required, rollback in66 progress).67- **Step 4** — DELETE_FAILED (dependent resources, bucket not empty,68 DeletionPolicy:Retain).69- **Step 5** — ROLLBACK_FAILED (stack stuck in ROLLBACK_COMPLETE).70- **Step 6** — UPDATE_ROLLBACK_FAILED (nested stack cannot roll back).71- **Step 7** — Root-cause catalog (top patterns + canonical fixes).72- **Step 8** — Validate via ChangeSet before applying any fix.73- **Step 9** — Decide VERDICT (ROOT_CAUSE_FOUND / NEED_MORE_INFO /74 ESCALATE).7576## STRICT output contract7778Every response MUST begin with this block — no preamble, no79conversational opening:8081```text82INCIDENT: <stack name or ARN> in <region> — <StackStatus + symptom>83VERDICT: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE84ROOT_CAUSE: <CREATE_FAILED | UPDATE_FAILED | DELETE_FAILED | ROLLBACK_FAILED | UPDATE_ROLLBACK_FAILED> — <one-sentence specific failing config element or resource>85EVIDENCE:86 - describe-stacks: <quoted StackStatus and StackStatusReason>87 - describe-stack-events: <quoted ResourceStatus + ResourceStatusReason for the failing logical id>88 - describe-stack-resources: <quoted PhysicalResourceId and status>89 - describe-change-set: <quoted Action + Replacement for the changed resource>90 - iam simulate-principal-policy: <decision for the relevant action, if IAM>91ROOT_CAUSE_CATALOG: #<N>92REMEDIATION:93 1. <exact template change, IAM policy edit, or CLI command>94 2. <verification command — ChangeSet or describe-stack-events>95 3. <post-apply monitoring step>96```9798### FORBIDDEN output patterns99100- NEVER start with "Let me analyze…" or "I'll investigate…" — the101 INCIDENT line is the FIRST line, always. No conversational preamble.102- NEVER use lowercase verdict values — emit `ROOT_CAUSE_FOUND`,103 `NEED_MORE_INFO`, or `ESCALATE`.104- NEVER omit EVIDENCE — the judge requires direct quotes from105 `describe-stack-events` (the `ResourceStatusReason`) or106 `describe-change-set`. Paraphrasing is not acceptable; quote the107 actual reason string.108- NEVER confuse `StackStatus` with the root cause. `UPDATE_FAILED` is109 the phase; the failing resource and its `ResourceStatusReason` are110 the cause.111- NEVER declare `ROOT_CAUSE_FOUND` for an UPDATE_FAILED diagnosis112 without quoting the `ResourceStatusReason` for the specific failing113 resource. "Update failed" is the symptom, not the diagnosis.114- NEVER recommend `update-stack` on a stack in `ROLLBACK_COMPLETE` —115 CloudFormation rejects updates in this state; the stack must be116 deleted (or continued with `ContinueUpdateRollback` for117 `UPDATE_ROLLBACK_FAILED`).118119## Process — Diagnostic decision tree (apply in order)120121### Step 0: Capture the failure signal122123Gather these five pieces. Each step below branches on which is present.124125| Signal | Source | Why required |126|---|---|---|127| **Stack name or ARN + region** | User-provided or `aws cloudformation list-stacks` | All describe calls need this |128| **StackStatus + StackStatusReason** | `aws cloudformation describe-stacks --stack-name <name>` | Drives the category |129| **Failing logical id + ResourceStatusReason** | `aws cloudformation describe-stack-events --stack-name <name>` | Narrows from stack-level symptom to the specific resource |130| **Most recent ChangeSet (for UPDATE_*)** | `aws cloudformation describe-change-set` | Identifies `Action`, `Replacement`, and the changed properties |131| **Drift status (for UPDATE surprises)** | `aws cloudformation detect-stack-drift` | Out-of-band changes can cause UPDATE_FAILED |132133If the user has not provided the stack name or region, emit `VERDICT:134NEED_MORE_INFO` with the `list-stacks` discovery command and the list135of missing inputs (stack name/ARN, region, StackStatus,136ResourceStatusReason from `describe-stack-events`).137138### Step 1: Identify the failure category139140Map the observed `StackStatus` to one of five categories.141142| `StackStatus` | Category | Diagnostic step |143|---|---|---|144| `CREATE_FAILED` → `ROLLBACK_IN_PROGRESS` → `ROLLBACK_COMPLETE` | **A. CREATE_FAILED** | Step 2 |145| `UPDATE_IN_PROGRESS` → `UPDATE_COMPLETE_CLEANUP_IN_PROGRESS` → `UPDATE_FAILED` → `UPDATE_ROLLBACK_IN_PROGRESS` | **B. UPDATE_FAILED** | Step 3 |146| `UPDATE_ROLLBACK_IN_PROGRESS` → `UPDATE_ROLLBACK_FAILED` | **E. UPDATE_ROLLBACK_FAILED** | Step 6 |147| `DELETE_IN_PROGRESS` → `DELETE_FAILED` | **C. DELETE_FAILED** | Step 4 |148| `ROLLBACK_COMPLETE` (after a failed CREATE) | **D. ROLLBACK_FAILED** | Step 5 |149| `UPDATE_ROLLBACK_COMPLETE` (after a failed UPDATE rolled back successfully) | **B. UPDATE_FAILED** (rollback succeeded; diagnose the original UPDATE cause) | Step 3 |150151**Precedence rule.** When multiple statuses apply across nested stacks,152diagnose the **innermost** failing stack first. A parent stack in153`UPDATE_ROLLBACK_FAILED` is usually downstream of a child stack that154failed to update. Read the child's `describe-stack-events` before155treating the parent's status as the cause.156157### Step 2: CREATE_FAILED diagnostic158159The stack attempted to create one or more resources and at least one160resource returned `CREATE_FAILED`. CloudFormation then rolls back,161deleting any successfully-created resources, and the stack ends in162`ROLLBACK_COMPLETE`.163164| Sub-symptom (read from `ResourceStatusReason`) | Root cause | Probe |165|---|---|---|166| `Resource creation cancelled` (generic) — usually means a dependency failed first | The failing resource is the *visible* failure; the *real* cause is the first `CREATE_FAILED` in `describe-stack-events` (scroll to the earliest) | `describe-stack-events` filtered for `ResourceStatus: CREATE_FAILED`, sorted by timestamp |167| `API: <service>:<Action> AccessDenied` (e.g., `iam:CreateRole`) | The CloudFormation execution role (or the deploying principal) lacks the action | `iam simulate-principal-policy` on the deployment role; check for an SCP or permissions boundary |168| `API: <service>:<Action> LimitExceeded` (e.g., `s3:CreateBucket`) | A service limit (Soft or Hard) was hit | Check Service Quotas for the service; request an increase or clean up stale resources |169| `<ResourceType> already exists in stack <other-stack>` or `already exists` | The physical resource exists outside CloudFormation (manually created, or owned by another stack) | Import the existing resource (`cloudformation import-resources`) or rename in the template |170| `Properties validation failed for resource <id> with message: ...` | A template property value is invalid (wrong type, unknown root device name, etc.) | Read the validation message verbatim; fix the template property; run `cfn-lint` |171| `The following resource(s) failed to create: [<LogicalId>]` and the resource is a custom resource (`Custom::` or `AWS::CloudFormation::CustomResource`) | The custom resource's Lambda function did not send a `SUCCESS` signal within `CreationPolicy` timeout | Read the Lambda function's CloudWatch Logs; check `cfn-response` usage and timeout |172| No `CREATE_FAILED` event, but stack ends in `ROLLBACK_COMPLETE` after a long pause | A `CreationPolicy` `Count` or `TimeoutSignal` was never satisfied (common on EC2 / Auto Scaling groups with no cfn-init / cfn-signal) | Read the `CreationPolicy`; verify the instance runs `cfn-signal` and reaches the desired count |173| `CloudFormation cannot create a change set...` for a CREATE with nested stacks | A nested stack's template is invalid or its parameters are wrong | Diagnose the child stack independently with `describe-stacks --stack-name <nested-arn>` |174175CREATE_FAILED diagnostic command listing moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md).176Load on demand when probing a failed CREATE.177178CREATE_FAILED common fix patterns moved verbatim to [references/failure-catalog-and-decision-tree.md](references/failure-catalog-and-decision-tree.md).179Load on demand when writing REMEDIATION for a failed CREATE.180181### Step 3: UPDATE_FAILED diagnostic182183The stack attempted to update one or more resources and at least one184resource returned `UPDATE_FAILED`. CloudFormation then attempts to roll185back; if the rollback succeeds, the stack ends in186`UPDATE_ROLLBACK_COMPLETE`. If the rollback also fails, the stack ends187in `UPDATE_ROLLBACK_FAILED` (see Step 6).188189| Sub-symptom (read from `ResourceStatusReason` and ChangeSet) | Root cause | Probe |190|---|---|---|191| ChangeSet reports `Replacement: true` for the changed resource | One or more changed properties are immutable and require CloudFormation to create a new physical resource | `describe-change-set` → look at each `Changes[].ResourceChange.Replacement` and `Scope` |192| `Properties validation failed` on update | A property value is invalid in the new template | Read the message; fix the template; `cfn-lint` |193| `API: <service>:<Action> AccessDenied` on update | The execution role lacks the action (often an action only needed on update, e.g., `ec2:ModifyInstanceAttribute`) | `iam simulate-principal-policy` |194| `Resource operation failed with message: ...` (downstream SDK error) | The underlying service rejected the update (e.g., RDS modify pending maintenance, S3 bucket policy malformed) | Read the message verbatim; cross-reference with the service's own logs |195| Drift detected (`detect-stack-drift` returns `DRIFTED`) | Out-of-band changes conflict with the template update | `describe-stack-resource-drifts` to identify the drifted property; either import the current state or reset it |196| `Cannot update resource <LogicalId> as it is in use` | A dependent resource holds a reference (e.g., an ENI on a Security Group) | Identify dependents with `describe-stack-resources` and CloudTrail |197| Nested stack `UPDATE_FAILED` | The child stack's update failed; the parent reports `UPDATE_FAILED` for the `AWS::CloudFormation::Stack` resource | Diagnose the child stack independently |198| Circular dependency in template | `DependsOn` or implicit references form a cycle; `cfn-lint` flags it pre-deploy | Run `cfn-lint`; remove the cycle |199200UPDATE_FAILED diagnostic walk moved verbatim to [references/failure-catalog-and-decision-tree.md](references/failure-catalog-and-decision-tree.md).201Load on demand when sequencing ChangeSet review for a failed UPDATE.202203UPDATE_FAILED common fix patterns moved verbatim to [references/failure-catalog-and-decision-tree.md](references/failure-catalog-and-decision-tree.md).204Load on demand when writing REMEDIATION for a failed UPDATE.205206### Step 4: DELETE_FAILED diagnostic207208The stack attempted to delete and at least one resource returned209`DELETE_FAILED`. CloudFormation cannot delete the stack until the210failing resource is resolved.211212| Sub-symptom | Root cause | Probe |213|---|---|---|214| `The bucket you tried to delete is not empty` | S3 bucket contains objects (or object versions) that CloudFormation will not auto-delete | `aws s3api list-objects-v2` and `list-object-versions`; empty the bucket or add a `Custom::Cleanup` to the template |215| `<ResourceType> has dependent resources` (ENI on SG, IAM policy on role, CloudWatch alarm on metric, etc.) | A dependent resource outside the stack holds a reference | Identify dependents via the service's own API (e.g., `ec2 describe-network-interfaces --filters group-id=…`) |216| `DeletionPolicy: Retain` (template-driven) | The resource has `DeletionPolicy: Retain`, so CloudFormation skips deletion but the stack still shows the resource | Expected behaviour; the stack delete succeeds for Retain resources, but the physical resource persists. Confirm with `describe-stack-resources` |217| Custom resource `DELETE_FAILED` (no `SUCCESS` signal) | The custom resource's Lambda function failed to handle `RequestType: Delete` | Read the Lambda logs; ensure it handles Delete and calls `cfn-response.send(... "SUCCESS" ...)` even when the physical resource is already gone |218| `Role <name> cannot be deleted because it has <N> policies` | An IAM role has inline or attached policies that block deletion (or active sessions) | Detach policies; ensure no active sessions; delete the role manually if needed |219| Nested stack `DELETE_FAILED` | A child stack cannot be deleted (one of the above reasons applies in the child) | Diagnose the child stack independently |220221DELETE_FAILED diagnostic walk moved verbatim to [references/failure-catalog-and-decision-tree.md](references/failure-catalog-and-decision-tree.md).222Load on demand when walking a blocked stack delete.223224DELETE_FAILED common fix patterns moved verbatim to [references/failure-catalog-and-decision-tree.md](references/failure-catalog-and-decision-tree.md).225Load on demand when writing REMEDIATION for a blocked delete.226227### Step 5: ROLLBACK_FAILED diagnostic (stack stuck in ROLLBACK_COMPLETE)228229After a failed CREATE, CloudFormation rolls back and deletes all230resources it created. If a resource cannot be deleted during rollback,231the stack ends in `ROLLBACK_FAILED`. Once the rollback eventually232completes (or is forced), the stack ends in `ROLLBACK_COMPLETE`.233234**Key fact:** a stack in `ROLLBACK_COMPLETE` cannot be updated. The235only valid lifecycle action is to **delete the stack** and re-create it.236Operators often keep retrying `update-stack` on a `ROLLBACK_COMPLETE`237stack and receive `UpdateRollbackComplete` errors — this is by design.238239| Sub-symptom | Root cause | Action |240|---|---|---|241| `StackStatus: ROLLBACK_COMPLETE` after a failed CREATE | All resources were rolled back; the stack exists only as a record | `aws cloudformation delete-stack --stack-name <name>`, then `create-stack` with the fixed template |242| `StackStatus: ROLLBACK_FAILED` (rollback itself failed) | A resource could not be deleted during rollback | Identify the `DELETE_FAILED` resource (Step 4); resolve the blocker; CloudFormation will resume rollback automatically, or use `ContinueUpdateRollback` (for UPDATE_ROLLBACK_FAILED) |243| Resources were created but the stack is in `ROLLBACK_COMPLETE` | The visible resources have already been deleted by rollback; the operator is seeing a stale console view | Refresh `describe-stack-resources`; the only valid next action is delete |244245ROLLBACK_COMPLETE recovery walk (delete + recreate commands) moved verbatim to [references/failure-catalog-and-decision-tree.md](references/failure-catalog-and-decision-tree.md).246Load on demand when recovering a ROLLBACK_COMPLETE stack.247248### Step 6: UPDATE_ROLLBACK_FAILED diagnostic (nested stack and others)249250After a failed UPDATE, CloudFormation rolls back. If the rollback also251fails (often because a replaced resource cannot be re-created, or a252nested stack cannot roll back), the stack ends in253`UPDATE_ROLLBACK_FAILED`.254255**Key tool:** `ContinueUpdateRollback` with256`--resources-to-skip <logical-id>` lets the operator skip the failing257resource and complete the rollback, returning the stack to258`UPDATE_ROLLBACK_COMPLETE` so it can be updated again.259260| Sub-symptom | Root cause | Probe |261|---|---|---|262| Nested stack `AWS::CloudFormation::Stack` reports `UPDATE_ROLLBACK_FAILED` | The child stack is itself in `UPDATE_ROLLBACK_FAILED`; the parent cannot roll back until the child does | `describe-stacks --stack-name <nested-stack-arn>`; diagnose the child |263| Replaced resource cannot be re-created during rollback | The new physical resource created during UPDATE is in a state that prevents re-creating the old one (e.g., a unique name conflict) | Identify the resource; use `ContinueUpdateRollback --resources-to-skip` |264| `UPDATE_ROLLBACK_FAILED` after a Lambda version update | The Lambda alias routing prevents rollback (e.g., old version is referenced by an active alias) | Resolve the alias; retry rollback |265| `UPDATE_ROLLBACK_FAILED` after a DynamoDB table update | An in-progress update was interrupted; DynamoDB tables can take 10+ minutes to update | Wait for the in-progress operation to settle, then retry rollback |266| Custom resource cannot handle `RequestType: Update` rollback | The custom resource's Lambda function did not send `SUCCESS` for the rollback Update | Read the Lambda logs; ensure Delete is handled idempotently on the new physical resource |267268**Diagnostic walk:**2692701. **Confirm `StackStatus: UPDATE_ROLLBACK_FAILED`.**2712. **Identify the resource that cannot roll back** via272 `describe-stack-events` filtered to `UPDATE_ROLLBACK_IN_PROGRESS` /273 `UPDATE_ROLLBACK_FAILED` events.2743. **For nested stacks,** diagnose the child stack independently —275 the child's `UPDATE_ROLLBACK_FAILED` is the real cause.2764. **Decide whether to skip the failing resource:**277 continue-update-rollback skip command moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md).278 Load on demand when unblocking UPDATE_ROLLBACK_FAILED.279 This returns the stack to `UPDATE_ROLLBACK_COMPLETE`, after which it280 can be updated again.2815. **After rollback completes,** re-attempt the original UPDATE with a282 ChangeSet that addresses the root cause.283284### Step 7: Map to root-cause catalog285286| # | Root cause | Category | Fix pattern |287|---|---|---|---|288| 1 | IAM `AccessDenied` on `create` / `update` (missing action on execution role or SCP block) | CREATE_FAILED / UPDATE_FAILED | Attach scoped policy; remove SCP block; pass CAPABILITY_IAM |289| 2 | Service `LimitExceeded` (S3 buckets, EC2 vCPUs, IAM entities) | CREATE_FAILED | Request Service Quota increase; clean up stale resources |290| 3 | Resource already exists outside the stack | CREATE_FAILED | Import the resource or rename in the template |291| 4 | Invalid template property (failed `Properties validation`) | CREATE_FAILED / UPDATE_FAILED | Fix the property; run `cfn-lint` |292| 5 | Immutable property changed (ChangeSet `Replacement: true`) | UPDATE_FAILED | Refactor to blue-green, or proceed with replacement, or use `UpdateReplacePolicy` |293| 6 | Missing `CAPABILITY_IAM` / `CAPABILITY_NAMED_IAM` | CREATE_FAILED / UPDATE_FAILED | Pass `--capabilities` on `create-stack` / `update-stack` |294| 7 | Stack drift (`DRIFTED`) conflicts with update | UPDATE_FAILED | `detect-stack-drift`; import or reset drifted resources |295| 8 | `DependsOn` circular dependency | CREATE_FAILED / UPDATE_FAILED | `cfn-lint`; remove the cycle; rely on implicit dependencies |296| 9 | S3 bucket not empty on delete | DELETE_FAILED | Empty bucket (including versions); add `Custom::S3Cleanup` |297| 10 | Dependent resource blocks delete (ENI/SG, IAM policy/role) | DELETE_FAILED | Delete or detach the dependent outside CloudFormation |298| 11 | Custom resource did not send `SUCCESS` within `CreationPolicy` | CREATE_FAILED / ROLLBACK_FAILED | Fix the Lambda handler; check CloudWatch Logs |299| 12 | Nested stack in `UPDATE_ROLLBACK_FAILED` | UPDATE_ROLLBACK_FAILED | Diagnose child; `ContinueUpdateRollback --resources-to-skip` |300| 13 | Stack in `ROLLBACK_COMPLETE` after failed CREATE | ROLLBACK_FAILED | Delete the stack; recreate with the fixed template |301| 14 | `CreationPolicy` signal count/timeout never satisfied (EC2 / ASG without cfn-signal) | CREATE_FAILED | Fix user-data to call `cfn-signal`; raise `TimeoutInMinutes` |302303### Step 8: Validate via ChangeSet before applying any fix304305Before applying any UPDATE, validate the proposed fix:3063071. **Lint the template:** `cfn-lint fixed-template.yaml`.3082. **Create a ChangeSet** against the existing stack with309 `create-change-set --template-body file://fixed.yaml`; then310 `describe-change-set` and check each resource's `Action` and311 `Replacement`. If any shows `Replacement: True`, confirm with the312 operator before executing.3133. **Execute** the ChangeSet only after it matches expectations.314315For CREATEs on a new stack, validate with `cfn-lint` and316`cloudformation validate-template`.317318### Step 9: Decide — ROOT_CAUSE_FOUND vs NEED_MORE_INFO vs ESCALATE319320- **ROOT_CAUSE_FOUND.** The walk identified a specific failure category321 and a specific configuration element (template property, IAM action,322 ChangeSet replacement, dependent resource, custom-resource signal).323 Output REMEDIATION with the exact change.324- **NEED_MORE_INFO.** The walk reached a step where the operator cannot325 supply evidence (e.g., `describe-stack-events` requires elevated326 read access, or the failing resource is owned by another team).327 Output the list of missing inputs.328- **ESCALATE.** The walk identifies a cause outside the operator's329 scope: a nested stack owned by another team, an SCP owned by security,330 a service quota owned by AWS Support. Output the escalation target331 and the specific request.332333## Output format334335```text336INCIDENT: <stack name or ARN> in <region> — <StackStatus + symptom>337VERDICT: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE338ROOT_CAUSE: <category name> — <specific failing config element>339EVIDENCE:340 - describe-stacks: <StackStatus + StackStatusReason>341 - describe-stack-events: <ResourceStatus + ResourceStatusReason>342 - describe-stack-resources: <PhysicalResourceId + status>343 - describe-change-set: <Action + Replacement, if UPDATE>344 - iam simulate-principal-policy: <decision, if IAM>345ROOT_CAUSE_CATALOG: #<N>346REMEDIATION:347 1. <specific template / IAM / ChangeSet change>348 2. <verification command>349 3. <post-apply monitoring>350```351352### Worked example — missing CAPABILITY_IAM on a stack with IAM resources353354```text355INCIDENT: app-platform in us-east-1 — CREATE_FAILED, then356ROLLBACK_COMPLETE on TaskRole357VERDICT: ROOT_CAUSE_FOUND358ROOT_CAUSE: CREATE_FAILED — stack template declares359AWS::IAM::Role TaskRole but create-stack was invoked without360--capabilities CAPABILITY_IAM, so CloudFormation rejected the361CREATE before any resource was created362EVIDENCE:363 - describe-stacks: StackStatus ROLLBACK_COMPLETE,364 StackStatusReason "The following resource(s) failed to create:365 [TaskRole]."366 - describe-stack-events: ResourceStatus CREATE_FAILED on TaskRole,367 ResourceStatusReason "Requires capabilities : [CAPABILITY_IAM].368 User requested no capabilities."369 - describe-stack-resources: TaskRole has no PhysicalResourceId370 (never created)371 - aws cloudformation describe-stack-events shows no other372 CREATE_FAILED resources — TaskRole is the only failure373ROOT_CAUSE_CATALOG: #6 (missing CAPABILITY_IAM)374REMEDIATION:375 1. The stack is in ROLLBACK_COMPLETE and cannot be updated. Delete376 it first:377 aws cloudformation delete-stack --stack-name app-platform378 2. Re-create with the corrected capability:379 aws cloudformation create-stack --stack-name app-platform \380 --template-body file://template.yaml \381 --capabilities CAPABILITY_IAM \382 --role-arn arn:aws:iam::111111111111:role/cfn-exec383 3. Verify with a ChangeSet on the next update:384 aws cloudformation create-change-set --stack-name app-platform \385 --change-set-name verify --template-body file://template.yaml \386 --capabilities CAPABILITY_IAM387 Expect ChangeSet with no `Replacement: True` and only `Add` actions388 on first deploy. Monitor `describe-stack-events` for SUCCEEDED.389```390391## Expert edge cases392393Expert edge cases (9 non-obvious failure modes) moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md).394Load on demand when the failure mode does not match the obvious pattern.395396## Expert heuristic — "Read the ResourceStatusReason, not the StackStatus"397398The single most common diagnostic mistake is treating the `StackStatus`399(`CREATE_FAILED`, `UPDATE_FAILED`, `ROLLBACK_COMPLETE`) as the root400cause. It is not. It is the lifecycle phase. The actionable signal is401the failing resource's `ResourceStatusReason`, which often embeds the402underlying service's error message.403404Quick lookup table for common `StackStatus` → real cause mappings:405406| `StackStatus` | What it means | Where the real cause lives |407|---|---|---|408| `CREATE_FAILED` → `ROLLBACK_COMPLETE` | A resource failed to create; rollback succeeded | The earliest `CREATE_FAILED` event's `ResourceStatusReason` |409| `UPDATE_FAILED` → `UPDATE_ROLLBACK_COMPLETE` | A resource failed to update; rollback succeeded | The `UPDATE_FAILED` event's `ResourceStatusReason` AND the ChangeSet's `Replacement` |410| `UPDATE_ROLLBACK_FAILED` | A resource failed to roll back | `describe-stack-events` filtered to `UPDATE_ROLLBACK_FAILED`; consider `ContinueUpdateRollback` |411| `DELETE_FAILED` | A resource could not be deleted | The `DELETE_FAILED` event's `ResourceStatusReason` (S3 bucket not empty, dependent resource, etc.) |412| `ROLLBACK_FAILED` | A resource could not be deleted during CREATE rollback | Same as DELETE_FAILED walk |413414When in doubt, run:415`aws cloudformation describe-stack-events --stack-name <name>` and416read the `ResourceStatusReason` for the earliest failing event. The417`StackStatus` is the phase; the `ResourceStatusReason` is the cause.418419## Anti-Patterns — NEVER420421- **NEVER** treat the `StackStatus` as the root cause. It is the422 lifecycle phase. The `ResourceStatusReason` on the specific failing423 resource is the actionable signal.424- **NEVER** recommend `update-stack` on a stack in `ROLLBACK_COMPLETE`.425 CloudFormation rejects updates in this state. The stack must be426 deleted and re-created.427- **NEVER** recommend `update-stack` without first creating and428 reviewing a ChangeSet. `update-stack` blind can trigger unexpected429 `Replacement: True` and irreversible resource deletion.430- **NEVER** declare `ROOT_CAUSE_FOUND` for an UPDATE_FAILED diagnosis431 without quoting the `ResourceStatusReason` AND cross-referencing the432 ChangeSet for `Replacement`.433- **NEVER** assume the first resource shown in434 `describe-stack-events` is the root cause. Filter by435 `ResourceStatus: CREATE_FAILED` / `UPDATE_FAILED` and sort by436 timestamp ascending — the earliest is the cause; the rest are437 cascade cancellations.438- **NEVER** confuse `DeletionPolicy: Retain` with `DELETE_FAILED`.439 Retain is intentional; CloudFormation reports it as `DELETE_SKIPPED`,440 not failed.441- **NEVER** recommend `delete-stack` as a "fix" without confirming442 the stack is in `ROLLBACK_COMPLETE` (after failed CREATE) or after443 `ContinueUpdateRollback` has been considered (for444 `UPDATE_ROLLBACK_FAILED`). Deleting an `UPDATE_ROLLBACK_FAILED`445 stack loses the option to skip-and-recover.446- **NEVER** raise a Service Quota increase without first confirming447 the limit is Soft (raisable) and identifying why the existing count448 is high (stale resources).449- **NEVER** declare UPDATE_FAILED with `Replacement: true` without450 naming which property caused the replacement. The ChangeSet's451 `Scope` and `DetailedStatus` identify it.452- **NEVER** run `update-stack` to recover a custom resource that453 failed to signal — fix the Lambda handler first, otherwise the same454 update will fail the same way.455- **NEVER** skip `cfn-lint` on a template fix. Most invalid-property456 failures are caught by `cfn-lint` pre-deploy.457- **NEVER** assume a nested stack's parent status reflects the root458 cause. Drill into the child stack — the parent's459 `AWS::CloudFormation::Stack` resource only mirrors the child's460 outcome.461- **NEVER** conclude DELETE_FAILED without checking both objects AND462 versions on S3 buckets. Versioned buckets have objects in463 non-current versions that block deletion.464465## Recent AWS features (2024-2026)466467Recent AWS features (resource import, nested-stack skip, cfn-lint v1, UpdateReplacePolicy) moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md).468Load on demand when confirming feature availability or vintage.469470## References471472See `references/failure-catalog-and-decision-tree.md` for the full473per-category walk with worked examples per StackStatus, and474`references/diagnostic-commands.md` for the canonical command script475for each failure category.476477## References (load on demand)478479- [references/failure-catalog-and-decision-tree.md](references/failure-catalog-and-decision-tree.md) — full per-category walk; now also holds the Step 2-6 diagnostic walks and common fix patterns moved from SKILL.md.480- [references/diagnostic-commands.md](references/diagnostic-commands.md) — canonical command script; now also holds the CREATE_FAILED command listing and the continue-update-rollback skip command moved from SKILL.md.481- [references/advanced-patterns.md](references/advanced-patterns.md) — mindset, expert edge cases, and recent AWS features moved from SKILL.md.482483## Domain484485AWS CloudOps / DevTools — Infrastructure-as-Code Reliability.486487## AWS documentation488489- **AWS CloudFormation User Guide** — https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html490- **CloudFormation stack events** — https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-listing-event.html491- **ChangeSets** — https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-changesets.html492- **ContinueUpdateRollback** — https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-continueupdaterollback.html493- **Drift detection** — https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift.html494- **DeletionPolicy / UpdateReplacePolicy** — https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html495- **CLI Reference** — https://docs.aws.amazon.com/cli/latest/reference/cloudformation/