For a classic ELB I used to call
elb.describeLoadBalancers
and received list of instances with IP addresses embedded in loadBalancerDescription
following this from sdk docs http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/ELB.html#describeLoadBalancers-property
Now we are switching to application load balancer so we need to switch to api version 2 http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/ELBv2.html
There is the same method there describeLoadBalancers
- however, for application loadbalancer there is a concept of targetGroups which includes instances.
In the response of elb.describeLoadBalancers from API version 2 there is no field like that.
How/what should I call to receive the same information like for classic loadbalancer?
After few hours of browsing through a documentation I am pretty sure that is is not possible to retrieve instances of Application Loadbalancer by loadbalancer name. Luckily, I had also tags on my instances so I was able to use method from EC2 API
describeInstances
including suitable tags as filters. There is also alternative option without tags - using healthchecks.