Can an on-premises load balancer be used to connect to AWS EC2 Autoscaling group?

225 views Asked by At

I have an on-premises load balancer that I wish to use to distribute traffic on EC2s in an Autoscaling group(ASG).

When AWS's Elastic Load Balancer(ELB) registers an ASG as a target, during a scale-out,new instances are automatically registered to ELB to route traffic to.

Can the same functionality be achieved in any way with an on-prem load balancer?

2

There are 2 answers

0
John Rotenstein On

There is in-built integration between Amazon EC2 Auto-Scaling and Elastic Load Balancers. The Auto Scaling systems knows how to modify Target Groups to add/remove instances. However, it has no knowledge about your on-premises load balancer.

You could use Amazon EC2 Auto Scaling lifecycle hooks to trigger additional code (that you write) to add/remove the instances to your own load balancer, but that would require an AWS Lambda function to communicate with the on-premises load balancer to update the configuration.

0
Derrops On

If you wanted to get the IPs of your target group you can do that do with an API call, and put that into your LB, but I think you may as well proxy calls from your LB to an ELB sitting on AWS which does the actual LoadBalancing. IMO there is way too much work and a lot could go wrong if you were to try and re-implement ELB features using Lambda functions.