AWS ELB/ALB Error 502

Diagnose 502 errors on AWS load balancers.

A 502 error on an Application Load Balancer (ALB) or Classic ELB AWS means the load balancer couldn't get a valid response from your instances. Here's how to diagnose.

Symptoms

  • Intermittent or permanent "502 Bad Gateway" error
  • Instances marked "unhealthy" in Target Group
  • Errors correlated with deployment
  • CloudWatch showing 5xx errors

Common Causes

  • Instance down: The application on the EC2 instance isn't responding.
  • Failing health check: Health check misconfigured or endpoint not responding.
  • Timeout: Application takes too long to respond (> idle timeout).

Diagnostic Steps

  1. Check Target Groups state in EC2
  2. Examine ALB logs in CloudWatch
  3. Test direct access to instance (bypass ELB)
  4. Check Security Groups and ports

Automate with MoniTao

MoniTao monitors your AWS endpoints:

  • HTTP monitoring of your domain/ALB
  • Immediate detection of 502 errors
  • History to correlate with your deployments

Best Practices

  • Configure realistic health checks
  • Use multiple AZs for redundancy
  • Adjust ALB idle timeout if needed
  • Enable access logs for debugging

FAQ

Difference between ALB and ELB?

ALB is the new generation, supporting HTTP/2, WebSockets, and advanced routing.

How to see why an instance is unhealthy?

In EC2 > Target Groups, click on the instance to see reasons.

What idle timeout to configure?

Default 60s. Increase if you have long requests.

Does MoniTao monitor AWS directly?

No, but it monitors endpoints exposed via your ALB/ELB.

Ready to Sleep Soundly?

Start free, no credit card required.