We've got an app where customers upload data and documents to a number of EC2 instances. We store the uploads on EBS volumes.
Occasionally our app will fail. Sometimes it's something in our app server, and sometimes it's bad EC2 hardware.
How can I recover a particular instance automatically? In other words, when an instance becomes unavailable for more than X minutes, I'd like to terminate the instance automatically, start a new one (possibly on new hardware), and attach the old EBS volume to it so the customer's data is preserved.
Is there some way to set up CloudWatch or autoscaling to do this?