I received the message "NetworkInterfaces associated with the Lambda Function to be cleaned up" when deleting a CloudFormation stack.

Last updated: 2021-08-13

I tried to delete an AWS CloudFormation stack, and received the message "CloudFormation is waiting for NetworkInterfaces associated with the Lambda function to be cleaned up". How do I fix this issue?

Short description

Requester-managed network interfaces are network interfaces created in your Amazon Virtual Private Cloud (Amazon VPC) by AWS services such as AWS Lambda. AWS CloudFormation uses elastic network interfaces, and elastic network interfaces can only be deleted by Lambda. Deleting an elastic network interface can take up to 45 minutes. This length of time depends on factors such as how many Lambda functions are using the elastic network interface.


To reduce the time to deleting elastic network interfaces with CloudFormation stacks, follow these steps.

1.    Make sure that the elastic network interface isn't used by other Lambda functions or versions. If the elastic network interface is associated with a Lambda function version, you must delete the function versions. This is because published Lambda function versions can’t be edited, and the Amazon VPC configuration can’t be changed. Follow the instructions to run the Lambda elastic network interface finder and delete the network interface.

2.    Route traffic away from the Lambda function before deleting the CloudFormation stack. This makes sure that the elastic network interface is removed automatically before the CloudFormation stack deletion. Manually change the Amazon VPC configuration for each Lambda function that share the same security group subnet combination to none. The Lambda service automatically deletes the elastic network interface after no traffic is routed.

Note: Lambda doesn't delete network interfaces for AWS accounts that are used by functions or function versions with the same Amazon VPC configurations as the functions that created the network interfaces.