ELB Network isn't redirecting traffic to Healthy instance

0

Hi,

I set up my ELB and Global Accelerator for my EC2 to manage my Node.js app. I have at least three instances in my ELB with listeners. To test if the ELB is working well, I stopped 2 out of 3 instances of my app. However, when I go to my domain.com, I get a **502 Bad Gateway error **(nginx error because the Node.js app is down).

It seems that the ELB isn't redirecting correctly. In my ELB, I have a listener on TCP port 5000 and 443. The health checks are working well.

However, I have no idea why the ELB is not showing the healthy instance.

Thanks for your help.

2 Answers
1

Ensure you have Cross-Zone Load balacning enabled as its off by default on an NLB

ALB https://docs.aws.amazon.com/elasticloadbalancing/latest/application/disable-cross-zone.html

NLB https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html#cross-zone-load-balancing

Also make sure the security groups are correct on all instances that allow access from the ELB and that the ELB can connect to the instances

profile picture
EXPERT
answered 3 months ago
profile picture
EXPERT
reviewed 3 months ago
0
Accepted Answer

Hello,

Your ELB might not be routing traffic due to security group or Network ACL issues.

Double-check inbound rules for ELB and instance security groups on ports 5000 (and 443 for HTTPS) to allow traffic from the internet/Global Accelerator.

  • I had two listeners set up on the ELB, one for 80 and one for 443, which was correct. The listener for 80 was set up correctly to forward to backend (Nginx) port 80 over HTTP as expected. The 443 listener was INCORRECTLY configured to send to port 80 on the backend over HTTPS. I updated the 443 listener to use the same rule as the 80 listener (i.e. listen on 443 but send to backend 80 over HTTP) and it worked.

For detailed troubleshooting steps, refer to AWS documentation on Network Load Balancers: https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-troubleshooting.html

profile picture
EXPERT
answered 3 months ago
EXPERT
reviewed 3 months ago
  • Yes understood.

    So now my question is : should i create another loadBalancer for another app ? because its owrking for my app listening on 5000 and 443 but another app not, so I should create new ELB for it ?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions