8

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.

Sam
  • 720
  • 2
  • 8
  • 18

2 Answers2

7

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.

Michael - sqlbot
  • 21,988
  • 1
  • 57
  • 81
  • What about NLB? NLB does not allow SSL but ELB does. However NLB supports adding mutliple instance ports to LB where as ELB does not. Is there way to support multiple ports for LB with SSL transport? – Haris Farooqui Aug 25 '18 at 00:03
  • 1
    @HarisFarooqui with NLB, the service running on your instance needs to handle the SSL. If you need (a) SSL offload by the balancer, (b) for a protocol other than HTTPS, and (c) multiple ports per instance, AWS does not have a balancer solution for this. – Michael - sqlbot Aug 25 '18 at 01:05
0

This is possible with Application Load Balancer (ALB)

CLI Documentation is available here

API documentation is here

You have to look for port override option in API documetation.

packetlord
  • 771
  • 6
  • 5