How long does it takes for ECS network interface to be fully removed?

0

I have an ECS Fargate service with a security group associated. This security group is only used by the Fargate service. If I decided to delete the service and the security group I'm having an error deleting the security group saying that the security group has some dependant objects. I get that this is due to the network interface created by the ECS service. What I would like to understand is how long it takes to AWS/ECS to clean these network interfaces after the services are deleted? I've tried to add a waiter after I delete the service waiting for the network interface to be gone but it is too variable and sometimes it can take more than 12 min!! Do I really need to wait until this network interface is gone to delete the security group? Is there another resource I can check to know that I can delete the security group? Is there a way to predict/make faster the deletion of the internal network interfaces created by ECS? It is quite annoying not having control over this.

  • Could you share some details on why you need to delete the service and security groups so frequently?

    Either way, setting the desired number of tasks for the service to 0 to stop all tasks will cause the tasks to be stopped and the corresponding ENIs to be released. That would let you delete the service.

  • Thank you for your comment @Mats_L. I have some integration tests poking the AWS API creating and deleting resources and this is generating brittleness in the tests. I am updating first the service to desiredCount=0 and then deleting the service, I have added some waiter logic after deleting the service, but still is not enough and sometimes it takes longer to release the ENI so my security group deletion fails :/

Keine Antworten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen