In the previous two notes, I showed how to set up HAProxy to route traffic using the round-robin algorithm and distribute load based on a CPU agent running on backend Amazon EC2 instances. In both cases, the HAProxy configuration file contained the backend instances' private IPs at the time of creation. However, in production, workloads … Continue reading HAProxy dynamic backend discovery with Auto Scaling Group and Lambda using Terraform
Tag: HAProxy
CPU-based routing with HAProxy agent-check on Amazon EC2
This note continues the previous one, where I set up HAProxy on an Amazon EC2 instance to route traffic to backend compute instances using Terraform. In that note, the algorithm was round-robin. HAProxy internally manages this as weighted round-robin, and since nothing was configured for the weights, traffic was split evenly across both instances. In … Continue reading CPU-based routing with HAProxy agent-check on Amazon EC2
Create an HAProxy load balancer with Amazon EC2 and Terraform
Load balancers route traffic to backend servers using algorithms such as round-robin, least-connections, or weighted routing based on server capacity. As of June 2026, AWS provides managed Application and Network Load Balancers, which abstract away routing logic so software engineering teams can focus on application development. However, engineering teams sometimes need full control over traffic … Continue reading Create an HAProxy load balancer with Amazon EC2 and Terraform


