I have 2 instances of the same web application running on port 8080 and 8081. I need to load balance using ALB/CLB. This used to be a simple thing in good old apache web server.The requirement is to load balance the instances below
Instance 1 Web App 1 Port 8080
Instance 1 Web App 2 Port 8081
Instance 2 Web App 1 Port 8080
Instance 2 Web App 2 Port 8081
I am not able to do this with ALB. I have tried creating 2 target groups, one for port 8080 and the other for port 8081. But in the listener rule, I can send the requests to different target groups based the path. But that is not going to load balance the whole site as such. Refer the screenshot
What are my options here ?
Thanks in advance
In an ALB, create one target group, adding each instance to the group, twice -- once for each port.
You can register each EC2 instance or IP address with the same target group multiple times using different ports, which enables the load balancer to route requests to microservices.
Note that this assumes what you are calling "app 1" and "app 2" are in fact the same application, just two different processes, as you described.