7

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.

5

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.

  • 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 0: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 1: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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.