Use Monit on AWS and Ubuntu
Examples # Monit local http process check process httpd with pidfile /var/run/httpd/httpd.pid start program = "/usr/bin/systemctl httpd start" stop program = "/usr/bin/systemctl httpd stop" if children > 250 then restart if 3 restarts within 5 …