1

I have an application load balancer (ALB) and a number of web servers behind it. Apart from HTTP and HTTPS, the web servers also serve long-lasting TCP socket connections on port 52345.

When a client socket tries to connect to the ALB on port 52345, it fails, because ALB does not have a listener on this port.

When I tried to add a listener on this port, I realized that ALB only allows listeners on HTTP and HTTPS. So I tried to add a HTTP listener on port 52345. It still didn't work.

Error message:

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 34.199.41.181:52345

How do I get over this hurdle? Why doesn't AWS allow TCP listener on ALB?

2 Answers 2

3

The ALB is specifically for http and https applications, not for general TCP. If you want a TCP load balancer you should consider using a NLB (Network Load Balancer). They scale to extremely high load and have some pretty useful features. The NLB can load balance any port including http/80 and https/443 but it's not application / protocol aware so it doesn't have capabilities such as path based routing. NLBs can have static (elastic) IPs.

If you need the capabilities of both types of load balancer you could consider using both. NLB could be on a subdomain or a fixed IP.

0
0

The above answer is not correct, application load balancers do work for TCP sockets, you just have to spend half a lifetime figuring it out. According to AWS, "Application Load Balancers provide native support for WebSockets":

https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html

I put together a brief step-by-step guide on how to set this up, if it helps. :)

https://stackoverflow.com/a/77182494/4045156

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .