Using AWS autoscaling to reboot unhealthy instance

amazon-web-servicesautoscalingload balancing

I intend to reboot a running AWS instance which has been marked as unhealthy behind an ELB.

I have a setup where 2 instances are behind a Load Balancer and one of them contains lot of (>200 Gb) data in ephemeral store. The data is not important so I don't want to put it in S3 or EBS and pay for it but I don't want to lose it either.

Is there a way to tell load balancer to detect unhealthy instances and hard reboot them instead of terminating?

Best Answer

Not able to make comments yet, but one important point, enabling termination protection will NOT stop an AutoScaling Group from terminating an instance

The DisableApiTermination attribute does not prevent Amazon EC2 Auto Scaling from >terminating an instance

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/terminating-instances.html#Using_ChangingDisableAPITermination