TL; DR - use foreverjs.
So there are two types of restart. One of them is code that throws an exception and stops the node. OS is still running. In this case, from the OS point of view, node decided to exit. None of this business. Here foreverjs plays a role - it will watch the node and reload it if it ever stops due to an exception / error, etc.
- . , , .. AWS ; , . ( - , ). , . - , - .