ValidationError Stackarn aws cloudformation stack is in ROLLBACK_COMPLETE state and can not be updated
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
When working with AWS CloudFormation stacks, encountering errors is not uncommon, especially during the creation, update, or deletion processes. One such common error is the "ValidationError: Stack:<stack_arn> is in ROLLBACK_COMPLETE state and can not be updated." Understanding this error, its implications, and resolving it are critical for managing AWS infrastructure effectively. This article delves into the causes, implications, and solutions to this error.
Understanding the ROLLBACK_COMPLETE State
CloudFormation Stack Lifecycle
Before diving into the specifics of the ROLLBACK_COMPLETE state, it's essential to understand the typical lifecycle states of an AWS CloudFormation stack:
- CREATE_IN_PROGRESS: The stack creation is currently in progress.
- CREATE_COMPLETE: The stack has been created successfully.
- CREATE_FAILED: The stack creation failed.
- ROLLBACK_IN_PROGRESS: The creation of the stack failed, and it is currently rolling back to delete any resources that were initially created.
- ROLLBACK_COMPLETE: The rollback process is complete, indicating a failure to create the stack fully.
The ROLLBACK_COMPLETE state arises when the stack creation process fails, and AWS CloudFormation can roll back the changes made to the point where no resources (or only partially configured resources) remain. This state indicates that some operations were unsuccessful, and the stack is not in a stable state to be updated.
Causes of ROLLBACK_COMPLETE State
Several reasons could cause a stack to enter the ROLLBACK_COMPLETE state:
- Incorrect Parameters: Invalid parameters passed during stack creation.
- Resource Conflicts: Conflicts with existing resources, such as unique resource name requirements or quota limits.
- IAM Permissions: Insufficient permissions to perform necessary operations.
- Configuration Errors: Errors in the cloud formation templates, such as incorrect resource definitions or unsupported configurations.
Implications of the ROLLBACK_COMPLETE State
A stack in the ROLLBACK_COMPLETE state cannot be updated until it's explicitly deleted. Applying updates to an unstable stack can lead to further resource misconfigurations and potential violations of infrastructure integrity. Therefore, AWS CloudFormation requires corrective action before any updates can proceed.
Resolving the ValidationError
To address the ValidationError, you must stabilize the stack by either deleting it or addressing the issues that led to the rollback state.
Steps to Resolve ROLLBACK_COMPLETE State
- Identify Failures: Investigate the stack events to determine the root cause of the rollback. This includes reviewing the CloudFormation events and associated error messages.
- Template Correction: If the issue is related to the CloudFormation template, correct the errors or misconfigurations before attempting a new stack creation.
- Parameter Validation: Ensure all parameters are correctly defined and valid for the target AWS environment.
- Resource Cleanup: Manually delete any partially created resources if necessary since they might incur costs or prevent subsequent stack creations.
- Delete the Stack: Once the issues leading to rollback are identified, delete the stack in the ROLLBACK_COMPLETE state.
- Re-create or Update the Stack: After deletion, recreate the stack with the corrected configurations or any updates required.
Example Workflow
Suppose a stack, "MyWebAppStack," entered the ROLLBACK_COMPLETE state due to a malformed S3 bucket name. Here's a simplified resolution workflow:
- Review Stack Events: Check the CloudFormation console logs for error messages indicating the S3 bucket name issue.
- Correct the Name: Modify the CloudFormation template to ensure the S3 bucket name meets AWS's naming requirements.
- Delete the Stack: Use the AWS Management Console, AWS CLI, or SDK to delete the stack.
- Recreate the Stack: Deploy the stack again using the corrected template, ensuring all parameters are checked for accuracy.
Table of Key Points
| Issue | Description/Resolution |
| ROLLBACK_COMPLETE | Stack is in a failed, rolled back state |
| Common Causes | Parameter errors, IAM issues, resource conflicts |
| Error Resolution Steps | Identify failures, correct template, delete stack, recreate stack |
Best Practices
To minimize the chance of encountering a ROLLBACK_COMPLETE state:
- Pre-deployment Validation: Use AWS CloudFormation Linter (cfn-lint) and validators to catch errors before deployment.
- Automation and Testing: Automate stack testing in a sandbox environment to robustly identify configuration issues.
- AWS CloudFormation Change Sets: Utilize change sets to preview changes and impacts before committing them to a stack update.
By understanding the nature of the ROLLBACK_COMPLETE state and following these best practices, AWS users can significantly reduce the potential for errors and facilitate smoother infrastructure management.

