Target Group gives unhealthy checks on my auto scaling instances and load balancer DNS gives 502 bad gateway

282 Views Asked by At

i have been struggling with trying to connect my load balancer with my auto scaling group, i have followed a Sam Meech-ward's video (link here: https://youtu.be/AmQeeB4ygZc), and i followed every step but didn't need to do HTTPS for the listeners, but the Load balancer DNS gives me 502 bad gateway and when checking on my target group, the two instances that the target group is monitoring (which are part of the auto scaling group) are both unhealthy, i tried to add a simple title in the user data of the launch template just to test if it will work but the load balancer DNS still gives me bad gateway, i checked my security groups and they allowed HTTP, HTTPS and all TCP connections, my instance doesn't run any program or app.Target group unhealthy

I mainly want the auto scaler and load balancer to help me with my ec2 freezing when i compile or do any heavy processing, then i will use it when the app is ready, i am still a bit novice here ^^" but thank you for reading my question.

1

There are 1 best solutions below

0
Roronoa Zoro On

"I suggest hosting the default Nginx Page on the instance and checking its accessibility using the instance IP. Then, try accessing it using the Load Balancer DNS. Ensure that proper security rules are enabled. Refer to the AWS documentation link below. Additionally, I recommend enabling logs for ALB/NLB and monitoring them to identify specific issues.

Steps to enable access logs for ALB/NLB:

  • Go to the AWS Management Console.
  • Navigate to Amazon EC2.
  • Select Load Balancers.
  • Choose your ALB/NLB and go to the Description tab.
  • Under Access logs, click Edit.
  • Enable access logs and specify an Amazon S3 bucket for storing logs. For troubleshooting, check the following AWS Docs:

Warm Pools Health Checks Monitor View Status EC2 Auto Scaling Health Checks