Deploying stack through AWS CDK failed with the Error: Stack deploy failed (the stack disappeared while we were deploying it)

0

This is something we have never seen before.

We usually deploy the same application stack multiple times during the day, and everything worked up until today. At one point the stack creation stopped and the resources started to delete. When the stack was deleted completely, I got the following error summary:

Deployment failed: Error: Stack deploy failed (the stack disappeared while we were deploying it)

At the same time in CloudTrail I see some activity from someone with the username "connect" (not our IAM user or any entity, so I suppose it's something internal to AWS).

CloudTrail

This is not something we have seen before, so if anyone knows how to avoid this issue going forward, let's discuss.

1 Answer
0

It seems like the stack deletion failed due to some resources being manually deleted beforehand.

Check if any IAM roles created for the stack resources are still present. Deleting dependent roles can cause deletion failures. Recreating roles with the same name may resolve it.

Look for resources in the DELETE_IN_PROGRESS state using the AWS console or CLI. Wait for these to complete deletion before retrying stack deletion.

Examine the CloudFormation event logs using AWS CloudTrail to identify the failed API operations during deletion. This may provide clues on which resources are blocking deletion.

Consider updating the stack template to remove references to already deleted resources before attempting deletion again. AWS CDK allows setting removal policies to avoid orphaned resources.

As a last resort, delete the stack forcefully using the --force option in the AWS CLI. This bypasses dependency checks and can remove stuck stacks, but use with caution.

Let me know if deleting gets stuck again.

profile picture
EXPERT
answered a month ago
  • The thing is the stack was in the process of creation. And at one point the resources started returning "CREATE_FAILED" status without any comments in the CloudFormation. So it's really a mystery of a kind. We didn't initiate the stack deletion and didn't delete any resources manually.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions