I'm using AWS Elastic Beanstalk, and very often when deploying an environment, the health check turns RED, but I can't find an explanation why:
Clicking on Monitor
doesn't help much:
Is there a way to have more specific information about why the environment turns RED?
For information, there is a healthy instance for this environment in my EC2, I've SSH'ed it and it does respond to HTTP requests, although when loading http://xxx.elasticbeanstalk.com/ from my browser, the request times out.
This is an old question but for the sake of people coming to this website, here is an update. Elastic Beanstalk recently announced support for Enhanced Application health monitoring.
https://aws.amazon.com/blogs/aws/elastic-beanstalk-update-enhanced-application-health-monitoring/
Now along with a health color, you can also discover "causes" which is an english language description for why the health of an environment transition.
You can also read about enhanced health reporting here: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/health-enhanced.html
AWS is pretty useless on health screen, it only shows "severe" on my screen, that`s it. I can see it on main screen too, I wonder why Amazon coders like to create pretty useless screens. If this happens during deploying your code, there is one reason for that, your instance t1.micro or t2.micro allocated and shared pretty small amount of resource. It looks like resources are not available during your deployment. If you are ready to pay, you will get your resources.
For me, this turned out to be because:
302
when going directly to/
and200
if I went to something like/index.html
, and the default health check path is/
200
.It can be details like that. So I would start by looking at the load balancer health check and the specific return code that you are getting, or something similarly simple.
You may have to make sure you're responding on the right address.
Check your server access logs to see what beanstalk is trying to hit and make sure you respond on that address.
Elastic Beanstalk uses the application health check monitoring provided by the ELB to detect whether any instances are unhealthy, and this is ongoing even during application deployment. If your application takes a long time to start up and deploy, then the ELB may see that one or more instances is unhealthy while it is restarting and Elastic Beanstalk will change the Health status to "yellow" or "red".
However, if this is the underlying cause then the status should go back to "green" shortly. If the health check stays red then you might have a different problem in your application.
This is exactly what my issue was. In my application Users who are not logged in get redirected to the login page (302). I edited the "Health checks" tab in "Target Groups" under "LOAD BALANCING" for the EC2 instance. I added 302 to the 200 that was already there (comma separated). It works now.