I am currently running wordpress on an Amazon ec2 instance, which runs fine with no problems most of the time, but occasionally outside connection to the instance shuts down. I can't access it over either http or ssh, and the server seems completely unresponsive (but the status checks pass). However, everything is fine if I simply stop and start the instance (not restart though). Although this problem is manageable, it is obviously extremely inconvenient and a problem for production. Does anyone know why this might happen? Thanks so much in advance!
Usually this is something you would want to contact AWS support about. Your instance's virtual network adapter could be messed up causing the disconnections, and that's something that only AWS support can handle.
It seems that you're running out of CPU credits and your instance freezes:
When an instance starts to run low on CPU Credits, its performance will gradually return to the baseline level (10% to 40% of a single core, as listed in the table above). This deceleration process takes place over the course of a 15 minute interval in order to provide a smooth and pleasant experience for your users.