We're using AWS ElasticBeanstalk to serve our Ruby on Rails application and have recently enabled auto scaling. The auto scaling works as expected but there is a brief period of time where immediately following the auto scaling, some of the new instances cause
502 Bad Gateway errors to be returned.
After a few minutes, the instances start working as expected. I'm not sure what is causing this I don't know what to do to prevent this from happening.
My hunch is that the instance is being put into service on the ELB before the RoR application is running but nginx doesn't know that. Is there something I can do to check that and prevent it?