Home > database >  AWS not able to delete network interface
AWS not able to delete network interface

Time:01-05

In AWS, i have network interfaces, which i am not able to delete, because they are supposedly in use. I have tried detaching them by the force option, but that deid not work.

How am i able to identify the object the network interface uses?

CodePudding user response:

The best way to find the resource which a network interface is attached to is checking the 'Description' field of the ENI.

Depending on the resource type this Description field could change. Some examples I get from my environment are:

  • DMS: "DMSNetworkInterface"
  • ElastiCache: "ElastiCache node-name"
  • ALB: "ELB app/alb-name/auto-id"
  • NLB: "ELB net/nlb-name/auto-id"
  • Nat Gateway: "Interface for NAT Gateway nat-id"
  • Transit Gateway Attachment: "Network Interface for Transit Gateway Attachment tgw-attach-id"
  • RDS: "RDSNetworkInterface"
  • EC2 Instance: "Primary network interface" or can be empty too. For this resource type the fields 'Instance details' contains the information.
  • VPC Endpoint: "VPC Endpoint Interface vpce-id"
  • Lambda: "AWS Lambda VPC ENI-lambda_name-id"
  • ECS Task: "ecs-attachment-arn"
  • etc

So checking the value of this field you can identify on most case the resource which use that ENI.

CodePudding user response:

If you created the network interface in the last 90 days, you can use the CloudTrail console: switch to the Event History tab, select "Resource name" as the lookup type, and the ENI ID as the resource.

This will still leave you with some detective work. For example, I have one ENI with the description "VPC Endpoint Interface vpce-0f6a4XXXXXXXXXXXX", which isn't very helpful.

Looking at the CloudTrail event, I can see that the sourceIPAddress is "redshift.amazonaws.com", and that it was invoked with the assumed role "AWSServiceRoleForRedshift". So I can infer that it was done behind the scenes, to support Redshift.

I can go back to the event history, select "Resource type" from the dropdown, and use "AWS::Redshift::Cluster" as the resource type. Matching the timestamps between the CreateNetworkInterface event and the CreateCluster event, I can infer that the network interface belongs to my Redshift Serverless cluster.

  •  Tags:  
  • Related