Impossible to delete VPC / Network Interface

0

HELLO everyone, I have created a VPC on eu-north-1 in order to follow a tutorial. Now, I don't need it anymore, and I have trouble deleting it.

I know it is connected to a network ACL and a subnet, but it seems impossible to detach it from either subnet or network ACL.

Here is what I get: Enter image description here Enter image description here

I got the same error even if I got to the network ACL page.

Anyone can help, please?

Thank you, Tahiry

Tahiry
asked 9 months ago326 views
8 Answers
3
Accepted Answer

Here are some of common cases:

  • Active load balancer that was attached to the ENIs
  • Active RDS instances
  • DMS Replication Instance
  • VPC links from API gateway
  • VPC Endpoint services
  • Unused NAT gateways
  • Unused ECS/EKS clusters

You'd need to delete these resources first based on what's applicable in your case. Note that these are just few common services, where we see this attached but there can be others too.

See, where are your security groups being used, can you detach security groups from those resources first, then try deleting the security groups first, if you see issues removing security groups, remove inbound/outbound rules from the security groups, then try deleting the security groups and then ENIs

Additional command references:

  1. aws ec2 delete-network-interface --network-interface-id <eni-name>

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

Also, if you have support plan, I'd suggest you to reach out to AWS Support by logging a case under Technical category. They are well equipped to address the issue in a precise way if none of the above helps.

Hope you find this helpful.

Comment here if you have additional questions, happy to help.

Abhishek

profile pictureAWS
EXPERT
answered 9 months ago
profile pictureAWS
EXPERT
iBehr
reviewed 9 months ago
2

Hello.
I think the network interface is being used by other services and therefore cannot be deleted.
First, we need to identify what service the ENI is used for.
Please check the ENI's Description for clues that may identify some services.

profile picture
EXPERT
answered 9 months ago
profile picture
EXPERT
reviewed 9 months ago
  • This can be confirmed by selecting Network Interface → ENI from the Management Console. The following image is an ENI for Lambda, but the description may include details that identify the service. lambda

  • Run the following command to see the ENI description.

    aws ec2 describe-network-interfaces\
     --filters Name=subnet-id,Values="subnet-id"\
     --query 'NetworkInterfaces[].{
         PrivateIpAddress:PrivateIpAddress,
         PublicIp:Association.PublicIp
         Name:TagSet[?Key==`Name`]|[0].Value,
         Description:Description,
         InstanceId:Attachment.InstanceId,
         NetworkInterfaceId:NetworkInterfaceId,
         Status:Status
     }'\
     --output table
    
  • From ENI's description, it seems that they have tied Lambda to the VPC. First, remove the VPC settings for that Lambda. If the Lambda is not needed, the entire Lambda can be deleted. If the ENI status changes from in-use after that, it can be deleted. https://repost.aws/knowledge-center/lambda-eni-find-delete

0

here it is Riku, subnet-dependencies

Tahiry
answered 9 months ago
0

I think it is connected to a lambda,

Description AWS Lambda VPC ENI-sam-spring-SamSpringApplication-lnVfK9xEpuZT-d2007dad-7a8b-4608-82f4-dac984ccc67d

Right ?

Tahiry
answered 9 months ago
  • Yes. I believe it is the ENI used by Lambda. So, you must first delete the Lambda VPC configuration or remove the Lambda if it is not needed.

0

Hey Riku, thanks for your answer, It is connected to 2 subnets. I think you are referring to the details panel here right? Enter image description here

But it couldn't be deleted from subnet

Tahiry
answered 9 months ago
0

There is no pannel to detach it from subnet as well,

subnet-association

Tahiry
answered 9 months ago
0

Thanks, secondabhi, Is there any AWS CLI command to list VPC or Network interface dependencies, please

Tahiry
answered 9 months ago
0

Thank you so much for all your support, it was solved

Tahiry
answered 9 months 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