I have a few Elastic Beanstalk environments. It took a while for me to get the first working, and then I replicated my settings to create the others. However, I am unable to get past a 502 error that the load balancer target health check gives, and it's the same if I try to load the app.
I checked the instance and load balancer security groups, and the settings match between the working and non-working environments (with the exception that the instance inbound source comes from the respective load balancer security group). The VPC settings are all the same. Among the non-working environments, I have apps in both availability zones 1a and 1b. The working environment is in 1a.
The Elastic Beanstalk app versions are the same. Elastic Beanstalk creates a load balancer per environment, so each environment has a different load balancer (I chose application load balancer).
I can SSH into the EC2 instances for both working and non-working environments. Curling my working environment health check URL succeeds: curl -i -k https://xx.xx.xx.xxx/health Curling my non-working environment health check URL fails: curl -i -k https://xx.xx.xx.xxx/health with a response that says "curl: (7) Failed to connect to xx.xx.xx.xxx port 443: Connection refused."
I double-checked the HTTPS settings for the EC2 and load balancer security groups, and they both have the appropriate inbound/outbound settings (as mentioned, the working and nonworking environments match). The environments both have a single load balancer listener for port 443 with a self-signed certificate using security policy ELBSecurityPolicy-2016-08, and the target group looks on port 443 for the port and health check.
I looked at the Elastic Beanstalk logs and didn't see anything noteworthy. From the nginx elastic beanstalk logs I see: xx.xx.xx.xx - - [19/Feb/2020:13:23:01 +0000] "GET / HTTP/1.1" 200 1410 "-""ELB-HealthChecker/2.0"
In the eb-docker logs for the working app, I also see:
2/13/2020, 9:22:13 PM - �[32minfo�[39m: req - /health �[0mGET /health �[32m200 �[0m14.449 ms - 56�[0m
(the req - /health being a log in the app for when the path doesn't match the specified app paths, in case of a 404).
I don't see this for the non-working environment.
I'm not sure what else to check or how to resolve this.