# Register/Deregister instances in a AWS Application LoadBalancer (ALB)

**URL:** <https://forum.ansible.com/t/register-deregister-instances-in-a-aws-application-loadbalancer-alb/25693>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [October 6, 2017, 2:43am UTC](https://forum.ansible.com/t/register-deregister-instances-in-a-aws-application-loadbalancer-alb/25693 "2017-10-06T02:43:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cyril](https://avatars.discourse-cdn.com/v4/letter/c/35a633/32.png) [@cyril](https://forum.ansible.com/u/cyril)\
**Post date:** [October 6, 2017, 2:43am UTC](https://forum.ansible.com/t/register-deregister-instances-in-a-aws-application-loadbalancer-alb/25693/1 "2017-10-06T02:43:56Z")

</div>

Hi everyone,

I’m trying to migrate from using AWS Classic ELB to ALB.  
In my playbook I’m using the elb\_instance module to de-register an instance from an ELB before upgrading the application version, then re-register the instance afterwards.  
That works very well with Classic ELB but elb\_instance doesn’t seem to work with ALB: I’m getting an “ELB my\_new\_alb does not exist” error.  
Looking at the code, I think elb\_instance doesn’t support ALB and would need to use Boto3’s ElasticLoadBalancingv2 API, which is of course, not trivial.

So I turned to the elb\_target\_group module, which seems to be the way to interact with the instances of an ALB, but the API is cumbersome to use for my case.  
I’d need to provide the whole list of the instances for a TG and do a modify\_targets.  
Meaning, when I de-register, I’d need the list of all instances and remove from it the one I want to de-register.  
Same principle for registering a new instance.

So my question is: is there a way I’m missing to simply register/register instances on ALBs?  
If not, is that under consideration (I couldn’t find anything on github)?

If using elb\_target\_group, is there a way to get the current instances of a target\_group?  
According to the documentation of elb\_target\_group\_facts or elb\_application\_lb\_facts, they don’t contain the targets.

Otherwise, what are my alternatives? Amend one of the plugins? Create a new one?

Thanks in advance,  
Cyril.
