(upbeat music)
- Hello.
I'm Aayush , a Cloud Support Engineer
here at the AWS office in Bangalore, India.
Today I'm going to show you,
how you can troubleshoot,
an AWS Lambda-backed custom resource,
that's stack in DELETE_FAILED status,
or DELETE_IN_PROGRESS status
with AWS cloudFormation.
Let's get started.
When a Lambda-backed custom resource,
is missing the logic to handle Delete requests,
and we try to delete a stack,
then we get the Custom Resource failed to stabilize
in expected time error message,
after an hour.
Also, the status of the stack changes to DELETE_FAILED.
Let's go through the step
on how to delete the stack successfully.
Situation number one,
in case the stack is already in DELETE_FAILED status
after logging in The AWS Management Console,
open AWS CloudFormation Console.
Choose the stack that contains your CustomResource
that stack in DELETE_FAILED status.
Then, click on the delete button.
in the pop up window
that provides a list of resources to retain,
choose the CustomResource
that stack in the DELETE_FAILED status,
then choose delete stack.
The status of your stack changes to DELETE_COMPLETE.
Note,
your custom resource isn't a physical resource,
so you don't have to clean up your custom resource
after stack deletion.
Case number two,
if the stack is already in DELETE_IN_PROGRESS status,
then we need to send a signal
back to the S3 pre signed URL
generated by CloudFormation.
To do so,
follow the following steps.
After logging into the AWS Management Console,
open the AWS CloudFormation Console.
Choose the stack that contains your custom resource
and that is stack in DELETE_IN_PROGRESS status.
Click on template tab.
From the template,
identify the name of Lambda function
that your custom resource is sending request to.
You can find the function name
from the service token property
of AWS CloudFormation CustomResource
or Custom pre string resource.
Now, open your Lambda console.
For that choose service,
search for Lambda
and choose Lambda.
From the navigation plane,
choose functions
and then choose the function that you identify
in tab number four.
For example,
AWS example Lambda function is the function name
in our case.
Choose the monitoring tab,
then choose View logs in CloudWatch.
In AWS CloudWatch console,
choose the latest logs.
Note,
you can see the CloudWatch logs only if your function
has access to Amazon CloudWatch logs for log streaming.
In the latest log,
identify the event where request type is delete,
and then copy the values for request ID,
response URL,
stack ID,
logical resource ID
and physical resource ID in a text file.
For example,
to send a success response signal
to the Delete request,
run a curl command from the terminal
with values we copied from step nine.
For example,
the status of your custom resource
changes to DELETE_COMPLETE in few seconds.
Now, the stack status changes to DELETE_COMPLETE.
Thanks for watching
and happy Cloud computing
from all of us here at AWS.
(upbeat music)