Error trying to detach network interface

0

Hello all,

I get the following error when trying to detach a network interface in CLI 2.0:

An error occurred (OperationNotPermitted) when calling the DetachNetworkInterface operation: The network interface at device index 0 cannot be detached.

Tried with both force and no force, instance is stopped still not able... Any help appreciated.

eni-attach-0867e4aaa19f25409 is this interface in question.

Thanks,

질문됨 3년 전16642회 조회
2개 답변
0

Hi jflinnergex,

Sorry to hear about the inconvenience you are facing. The primary network interface is assigned to network card index 0, which is what you are trying to detach, however you can only detach a secondary network interface. Each instance has a default network interface, called the primary network interface. You cannot detach a primary network interface from an instance, and it will only get detached or released when the instance is terminated. If you need to preserve the ENI please make sure the delete on termination flag is not selected when terminating the instance: https://docs.aws.amazon.com/cli/latest/reference/ec2/modify-network-interface-attribute.html
For more information: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#eni-basics

I hope this helps. Let me know if you have any questions.
Warm regards,
awsamy

amz99
답변함 3년 전
profile picture
전문가
검토됨 한 달 전
0

I also faced the same issue when I wanted to remove all the resources I had created. This act was to avoid any charges for the services I wasn't using. So if your case is also similar to this then terminate the EC2 instance. With the termination of the EC2 instance-associated Network interfaces, subnets will get removed. However please cross check once on the EC2 dashboard what services are being used post termination.

답변함 9달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠