Search code examples
amazon-web-serviceshaproxyec2-ami

How to use Haproxy in Aws auto scaling instead of ELB?


How to use Haproxy in Aws auto scaling instead of ELB and also how to integrate existing aws instance setup into auto scaling.


Solution

  • You can add a notification to your auto scaling group. That will add a message to a SNS topic every time an auto scaling action occurs. You can subscribe an SQS queue to the topic and consume using a script to adjust your HAProxy configuration in reaction to each event.

    Another option would be to add instances to the load balancer in the user-data script, but then you need to make sure the balancer can gracefully remove them if they disappear.