How can I delete an "in-use" network interface that is no longer actually in-use?

0

I have a network interface (eni-042364fcb6f4babfe) that had been attached to an ECS task. The entire ECS cluster has since been deleted along with everything else in the stack with the exception of this network interface and the security group its using. All attempts to delete the network interface fail with "Network interface is currently in use." but I can't find anything else possibly using it.

3 Answers
2

Run the following command to find the remaining dependencies. Be sure to replace vpc-id with your VPC ID and NetworkInterfaceId

aws ec2 describe-network-interfaces --filters 'Name=vpc-id,Values='$vpc | grep NetworkInterfaceId

answered a year ago
  • Thanks but that just gives me the info about the network interface I'm trying to delete. There isn't any attachment info. The description indicates an ECS attachment but there isn't anything in ECS to delete.

    { "NetworkInterfaces": [ { "AvailabilityZone": "us-east-1b", "Description": "arn:aws:ecs:us-east-1:XXXXXX:attachment/6b329514-eb5c-469a-8c8b-824c5f137502", "Groups": [ { "GroupName": "dev-release-ecs", "GroupId": "sg-057d044a0225fd3b7" } ], "InterfaceType": "branch", "Ipv6Addresses": [], "MacAddress": "0a:c7:53:2b:43:1d", "NetworkInterfaceId": "eni-042364fcb6f4babfe", "OwnerId": "XXXXXX", "PrivateDnsName": "ip-10-12-6-205.ec2.internal", "PrivateIpAddress": "10.12.6.205", "PrivateIpAddresses": [ { "Primary": true, "PrivateDnsName": "ip-10-12-6-205.ec2.internal", "PrivateIpAddress": "10.12.6.205" } ], "RequesterId": "YYYYYY", "RequesterManaged": true, "SourceDestCheck": true, "Status": "in-use", "SubnetId": "subnet-0466e11da627b5a60", "TagSet": [], "VpcId": "vpc-067c433463dfcd6b4" } ] }

  • It's worth contacting support about this; they can investigate why the network interface is still showing as in-use.

  • Thanks Brettski@AWS. Does that mean I have to upgrade from basic support to open a ticket? I haven't had to open a technical support before. It seems strange that I have to pay to have AWS address an issue on their side.

0

Assuming you created/deleted this ECS cluster on the console, have you checked if the Cloudformation Stack has successfully removed all resources? As explained here: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create_cluster.html

The console cluster creation wizard provides a simple way to create the resources that are needed by an Amazon ECS cluster by creating a AWS CloudFormation stack.

answered a year ago
  • Interesting that Console uses CloudFormation. But it was created and deleted using Terraform. I don't have any CloudFormation stacks.

0

Look for all objects that could be associated with the VPC that contains these un-deletable Network Interfaces like Load Balancers, EndPoints, Volumes, RDS db, etc., and delete them.

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions