I'm running into two distinct, but related, issues with a Rails app (Ruby 1.9.3) I have deployed on AWS' Elastic Beanstalk. I have the following autoscaling config applied. I believe it is the default.
- Environment type: Load balanced, auto scaling
- Number instances: 1 - 4
- Scale based on Average network out
- Add instance when > 6000000
- Remove instance when < 2000000
Issue #1 - My app doesn't get very much traffic yet and only requires 1 EC2 instance (m1.medium). I get several "ElasticBeanstalk Default Scale Down alarm" emails from AWS each week. Most of the time, I check my app after receiving one, and it's fine; however, about once a month, I check my app after receiving the email and find the nginx 404 page. EB has terminated my EC2 instance - the only one running my app - and generated a new one. Why is it scaling down from 1 to 0? This has happened to me with consistency for the past 6 months. Has anyone else experienced this? Found a solution?
Issue #2 - When the above situation happens, EB creates a new EC2 instance for me. But, I continue to get the nginx 404 page until I re-deploy - which is a manual task and seems to defeat the purpose of auto scaling. Does EB require a re-deploy after autoscaling occurs? Shouldn't it automatically deploy the current/latest version of my app to the new EC2 instance(s)?
Any help/advice is greatly appreciated!