Select Language:
If you’re having trouble deleting a custom Lambda stack using CDK because it’s stuck, here’s a simple way to fix the problem. The issue usually happens when the Sync stack gets stuck, often because the CustomResource Lambda doesn’t send a response back to CloudFormation. As a result, the stack deletion begins before the creation finishes, leaving the stack in a DELETE_IN_PROGRESS state.
To resolve this, you need to tell CloudFormation to ignore the stuck stack and force the deletion through the AWS Management Console or AWS CLI. Here’s what you can do:
1. Log into your AWS Management Console.
2. Navigate to the CloudFormation service.
3. Find the stack that is stuck in DELETE_IN_PROGRESS.
4. Select the stack and choose the delete option.
5. If the delete option is disabled or fails, you may need to perform a stack deletion rollback.
6. If deletion still won’t proceed, you can use the AWS CLI with the command:
aws cloudformation delete-stack –stack-name your-stack-name
7. Sometimes, CloudFormation may get stuck in the deletion process due to resources like Lambda or custom resources that don’t respond. In this case, go to the individual resources to manually delete or update them.
Once the stuck delete loop is cleared, you can re-try deploying your CDK stack. To prevent this from happening again, make sure your CustomResource Lambdas correctly handle responses and ensure any creation or updates are fully completed before attempting deletion.
By following these steps, you can clear the stuck deletion status and restore your stack to a clean state.




