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,

preguntada hace 3 años16640 visualizaciones
2 Respuestas
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
respondido hace 3 años
profile picture
EXPERTO
revisado hace un mes
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.

respondido hace 9 meses

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas