title: AWS Beanstalk, how to reboot (or terminate) automatically an instance that is not responding
body: <p>I have my Beanstalk environment with a <em>"Scaling Trigger"</em> using <em>"CPUUtilization"</em> and it works well. </p>
  
  <p>The problem is that I can not combine this with a system that automatically reboots (or terminate) instances that have been considered <em>"OutOfService"</em> for a certain amount of time.</p>
  
  <p>Into the <em>"Scaling > Scaling Trigger > Trigger measurement"</em> there is the option of <em>"UnHealthyHostCount"</em>. But this won't solve my problem optimally, because it will create new instances as far there is one unhealthy, this will provoque my environment to grow until the limit without a real reason. Also, I can not combine 2 <em>"Trigger measurements"</em> and I need the CPU one.</p>
  
  <p>The problem becomes crucial when there is only one instance in the environment, and it becomes OutOfService. The whole environment dies, the Trigger measurement is never triggered.</p>