I have a stack with:
When deleting this CloudFormation stack from the AWS console, the process is very slow.
Everything works fine until you execute the exclusion of 'AWS :: Lambda :: Function' -> 'CloudFormation is waiting for NetworkInterfaces associated with the Lambda Function to be cleaned up.'
The time in this process takes about 30 minutes.
Has anyone had the same problem?
To prevent this from blocking the stack deletion, you could set a DeletionPolicy property to Retain for that specific Lambda and have another scheduled process that would clean up each day the orphaned Lambdas.
Check that the lambda function assigned Role has delete permissions for the network interface, ie all of these:
- ec2:CreateNetworkInterface
- ec2:DescribeNetworkInterfaces
- ec2:DeleteNetworkInterface
If it is unable to delete the interface the Cloudformation template might hang, as you have experienced.
If that doesn't work you might have to script something to delete the ENIs on the lambda while the lambda is trying to teardown.