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
エキスパート
レビュー済み 1ヶ月前
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ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ