Map one AWS ELB load balancer port to balance to multiple instance ports

amazon-elbamazon-web-services

Lets say I have multiple processes running on multiple EC2 instances each on different ports. Can I map a single AWS ELB to balance to any of these processes across any instance?

For example, I'd ideally like a setup like this:

HTTPS 443 -> Instance 1 Process 1 Port 8081
       or -> Instance 1 Process 2 Port 8082
       or -> Instance 2 Process 1 Port 8081
       or -> Instance 2 Process 2 Port 8082

Is there any way to configure ELB like this? I'm trying to avoid running a load balancer on each instance to balance across that instance's processes.

Best Answer

Important Update

The service offering has evolved, so the following information (the original answer) is only applicable to ELB/1.0, which is now called an ELB Classic Load Balancer:


No, this isn't possible with ELB.

You can map multiple listeners on the front-side of an ELB to hit a single port on the back-end instances, but you can't map a single listener on the font-side of an ELB to hit multiple ports on the back-end instances.


ELB/2.0, called Application Load Balancer was released in late 2016 and does support multiple instance ports, using "target groups."

It also allows selective request routing by path pattern matching, supports web sockets in HTTP mode, and HTTP/2 on the front side.

When launching a balancer, you can still launch a Classic (it's still available, and the single instance port limit per listener still applies) or you can launch an ALB to get the new functionality.