Every now and then Elastic Load Balancer (ELB) kicks out one of my servers for being unavailable. Which is good -- hardly any interruption.
Usually, just rebooting the instance through the AWS Console fixes the problem.
I would like to have my EC2 instance automatically reboot when it becomes unavailable.
What's the best way to do this? (it happens to be a Windows instance, but ideally that shouldn't matter)
If an instance fails these status checks, it is marked unhealthy and is terminated while Amazon EC2 Auto Scaling launches a new replacement instance. You can attach one or more load balancer target groups, one or more Classic Load Balancers, or both to your Auto Scaling group.
An instance might fail the ELB health check because an application running on the instance has issues that cause the load balancer to consider the instance out of service.
I got a cheap EC2 micro instance and wrote a simple script that lists all my servers on EC2, and does a GET on each one to make sure that it's functioning properly. If a server isn't functioning properly, my script reboots it. I have the script running once every 10 minutes.
Woulda been slightly easier if there were a service out there to do this for me, but the system was easy to set up and the micro instance is cheap.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With