How do I troubleshoot CloudFormation stack issues in my AWS Amplify project?
Last updated: 2022-04-05
When I try to deploy my AWS Amplify application, I receive an AWS CloudFormation error similar to the following: "Resource is not in the state stackUpdateComplete". How do I troubleshoot the issue?
To troubleshoot CloudFormation stack issues in your Amplify project, first identify what's causing the issue by reviewing the following in the CloudFormation console:
- The Status code and Status reason of the backend stack.
- The Status, Status reason, and Logical ID values of the backend stack's recent Events.
- The Status, Status reason, and Logical ID values of the backend stack's Resources.
Note: The Status reason value contains an error message returned by CloudFormation that identifies what's causing the error.
Then, remediate the issue based on the Status, Status reason, and Logical ID values listed in the console.
Note: The CloudFormation stacks that Amplify provisions or updates can return errors for many reasons. The following are the most common reasons why CloudFormation stacks return errors associated with Amplify projects:
- Misconfigurations in the associated Amplify project
- Missing files in the associated Amplify project
- Using an outdated version of the Amplify Command Line Interface (Amplify CLI)
Identify what's causing the issue by reviewing the stack's status codes and status reasons in the CloudFormation console
1. Open the Amplify console.
2. Choose the Backend environments tab. Then choose your application's backend environment.
3. Choose the Overview tab. Then, choose View in CloudFormation. The backend environment's associated CloudFormation stack's Stack info page opens in the CloudFormation console.
4. In the Overview pane, review the Status and Status reason values. This is the backend stack's status code Status reason.
Note: If the project's root stack is in the UPDATE_ROLLBACK_FAILED status, then follow the instructions in this article: How can I get my CloudFormation stack to update if it's stuck in the UPDATE_ROLLBACK_FAILED state?
5. Choose the Events tab. Review the Status, Status reason, and Logical ID values for all of the recent events that are in a failed status.
Note: Make sure that you identify any events with the UPDATE_FAILED status.
6. Choose the Resources tab. Review the Status, Status reason, and Logical ID values for all of the resources that are in a failed status.
7. (For nested stacks only) On the Resources pane, look for resources of type AWS::CloudFormation::Stack. Then, review the Status reason values for the nested stacks that are in a failed status.
Important: When troubleshooting, ignore resources that failed with a Resource update cancelled status. This status signifies a dependent, downstream resource that didn't fail, but also wasn't updated because of another resource failure.
Remediate the issue based on the Status, Status reason, and Logical ID values listed in the console
Note: It's a best practice to test solutions in a nonproduction environment first.