Troubleshooting CloudFormation Stack Failures
This lesson explains how stack events and status codes show what happened and what to do next, since the exam guide names CloudFormation errors as a deployment issue to remediate.
Learning outcomes
After completing this lesson, you will be able to:
- Find the root cause in stack events.
- Recover from stack status codes such as UPDATE_ROLLBACK_FAILED.
- Resolve permissions and service role issues.
Reading stack events
The Events tab (describe-stack-events) lists every status change with a status reason. The first CREATE_FAILED or UPDATE_FAILED event is the root cause; later failures are usually cancellations. Typical reasons are invalid property values, resources that already exist with the same name, insufficient permissions, service quotas, and resources that failed to stabilise. Disable rollback (or preserve successfully provisioned resources) keeps resources after a failure for troubleshooting, and the operation can then be retried from the failure point.
Stack status codes
The following table lists the statuses that need operator action and how to recover.
| Status | Meaning | What to do |
|---|---|---|
| ROLLBACK_COMPLETE | Stack creation failed and was rolled back | Fix the cause, delete the stack and create it again (it cannot be updated) |
| ROLLBACK_FAILED | Rollback after a failed create could not delete some resources | Fix the blocking resource, then delete the stack |
| UPDATE_ROLLBACK_FAILED | Rollback after a failed update could not restore a resource | Fix the resource or dependency, then ContinueUpdateRollback, optionally skipping resources |
| DELETE_FAILED | A resource could not be deleted (non-empty bucket, dependency, manual change) | Fix or empty it, or delete again retaining that resource |
| UPDATE_COMPLETE_CLEANUP_IN_PROGRESS | Old replaced resources are being deleted | Wait |
The following diagram shows how each problem status is reached and resolved.

Recovering from stack states
Permissions and service roles
CloudFormation acts with the permissions of the user who calls it unless a service role is specified, in which case it uses that role for all operations on the stack. Service roles let operators deploy stacks without holding broad permissions themselves: they need only cloudformation:* on the stack and iam:PassRole for the service role. Templates that create IAM resources need the CAPABILITY_IAM or CAPABILITY_NAMED_IAM acknowledgement, and macros need CAPABILITY_AUTO_EXPAND. If a service role is later deleted, stack updates and deletes fail until it is recreated.
Stack permission errors
UPDATE_ROLLBACK_FAILED
An update to a stack fails, and the rollback then fails too, leaving UPDATE_ROLLBACK_FAILED. The events show that rollback tried to restore an Auto Scaling group's launch template version that an administrator had deleted manually. The stack cannot be updated or deleted in this state. The operator runs continue-update-rollback with --resources-to-skip WebASG, which marks the resource as rolled back without changing it, and the stack returns to UPDATE_ROLLBACK_COMPLETE. A drift check and a corrective update then align the group with the template.
aws cloudformation describe-stack-events --stack-name web-prod \
--query "StackEvents[?contains(ResourceStatus,'FAILED')].[Timestamp,LogicalResourceId,ResourceStatusReason]" \
--output table
aws cloudformation continue-update-rollback --stack-name web-prod --resources-to-skip WebASGA stack is in ROLLBACK_COMPLETE after a failed creation. What must be done?
Show answer
Delete it and create it again; it cannot be updated.
Exam Tips
Remember for the exam
- The first FAILED event in the stack events is the root cause.
- ROLLBACK_COMPLETE stacks must be deleted and recreated.
- UPDATE_ROLLBACK_FAILED: fix the cause and continue update rollback, skipping resources if necessary.
- DELETE_FAILED: empty buckets or retain the blocking resource.
- Service roles need iam:PassRole; IAM resources need CAPABILITY_IAM or CAPABILITY_NAMED_IAM.