I want to delete an elastic network interface that I no longer use from an Amazon Virtual Private Machine (Amazon VPC)?
If a resource is using the elastic network interface, then you can't delete the elastic network interface. To resolve this issue, identify the resource that's using the elastic network interface and delete the resource if it's no longer required. After you delete the associated resource, you can delete the elastic network interface.
If you try to delete an elastic network interface that's assigned to or owned by a running resource, then you see the following API error:
"Error: An error occurred (InvalidParameterValue) when calling the DeleteNetworkInterface operation: Network interface 'eni-xxxxxxxxxxxxxxxxx' is currently in use."
A requester-managed network interface is a network interface that an AWS service creates in your Amazon VPC for you. When you delete a resource that's associated with a requester-managed network interface, the AWS service detaches the network interface and deletes it. If the AWS service detached the network interface but didn't delete it, then you can delete the detached network interface.
If you try to detach an elastic network Interface that an AWS managed service created and owns, then you see the following API error:
"Error: An error occurred (AuthFailure) when calling the DetachNetworkInterface operation: You do not have permission to access the specified resource."
To delete the elastic network interface, use either AWS Command Line Interface (AWS CLI) commands or the Amazon Elastic Compute Cloud (Amazon EC2) console.
Use AWS CLI commands
1. Note the elastic network interface ID.
2. To see more information about the resource, use AWS CloudShell or the AWS CLI to run the describe-network-interfaces command. Replace ENI_ID with the elastic network interface ID, in the format eni-xxxxxxxxxxxxxxxxx. Replace region_name with the AWS Region where your elastic network interface is located. For example, us-west-2.