Say nginx on an EC2 instance crashes. The instance is healthy and CloudWatch Metrics are great, but all the domains hosted on the server are now "Connection refused".
This seems like a very basic function - monitoring to ensure a website is returning a 200. Is this somewhere in CloudWatch? I would think something could just curl -s -o /dev/null -w "%{http_code}" http://www.example.org/
and if it doesn't receive a return code of 200, say 5 times in a row, it will trigger an instance restart and SNS notification.
Perhaps there is something I should be running on the EC2 instance that would restart nginx if something is unreachable? Either way, I'd love to know how to do this with an AWS resource, so I could even monitor any site and kick off an SNS.
Sorry if I'm missing something easy here. It just seems this would something easily searched, but I have spent hours across months trying to figure this out.