Search code examples
amazon-web-servicesubuntuamazon-ec2instance

EC2 instance shuts down by itself


EC2 Instance Type: t2.micro OS: Ubuntu 16.04.3 Config tool:Webmin

The instance has the "Instance State" as "running" but it is not really working. If I do right click -> "Instance State" -> "Stop" / "Start" then I can connect to the machine easily but after a while it goes again off.

When I try to connect I get

This site can’t be reached 18.217.7.112 refused to connect.

after a Stop -> Start of the instance everything works again.

Can anyone help me troubleshoot this? Not sure where to look and what to look for.

Thank you!


Solution

  • The solution I found seems to have worked. I had another turn off, indeed, but maybe that was needed to take the new settings into account. So here is exactly what I did

    • I issued the command $ sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
    • My machine stopped again by itself even though in AWS it was showing "Running"
    • then I did a right click and "Reset" from AWS screen

    So my guess is that issuing the command and then reboot should do the job. My machine is still up and running since Friday.