# Properly delete Amazon EC@ elastic load balancer

**URL:** <https://forum.ansible.com/t/properly-delete-amazon-ec-elastic-load-balancer/18850>\
**Category:** Ansible Project\
**Created:** [July 25, 2015, 3:13am UTC](https://forum.ansible.com/t/properly-delete-amazon-ec-elastic-load-balancer/18850 "2015-07-25T03:13:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Erik\_Steffl](https://avatars.discourse-cdn.com/v4/letter/e/9de0a6/32.png) [@Erik\_Steffl](https://forum.ansible.com/u/Erik_Steffl)\
**Post date:** [July 25, 2015, 3:13am UTC](https://forum.ansible.com/t/properly-delete-amazon-ec-elastic-load-balancer/18850/1 "2015-07-25T03:13:49Z")

</div>

Deleting the elastic load balancer (ELB) sort of works (using [http://docs.ansible.com/ansible/ec2\_elb\_lb\_module.html](http://docs.ansible.com/ansible/ec2_elb_lb_module.html)) but it does not delete ELB elastic network interfaces (ENI), these are deleted later by Amazon background process. This is mostly invisible to the user.

The problem is that the ENI is in the same subnet(s) and uses the same security group(s) as the ELB. Which means that deleting of ELB security group(s) and subnet(s) somewhat mysteriously fails with error " resource sg-xxxxxxxx has a dependent object". Re-running the delete task later on (usually few minutes later) works (ENI is removed by Amazon in the meantime).

This is also discussed at [http://unrouted.io/2015/04/12/elb-deletion/](http://unrouted.io/2015/04/12/elb-deletion/)

Is this a known problem? Any ideas how to handle it now? Any plans to handle it by ec2\_elb\_lb module?

It seems that currently there is no workaround possible (in 1.9.2, I see that ec2\_eni module is available in 2.0)

Any ideas how to handle it in 2.0? It seems that the only way to figure out that the ENI belongs to a particular ELB is the description, I don’t see how to check if ENI with a given description exists.

Thanks!

erik

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 25, 2015, 3:19am UTC](https://forum.ansible.com/t/properly-delete-amazon-ec-elastic-load-balancer/18850/2 "2015-07-25T03:19:59Z")

</div>

it might be something we need to add to the modules, most of them  
depend on boto, so if the capability is there it should not be hard to  
add
