My AWS Linux AMI EC2 instance runs fine for a few days but then https, ssh and vsftp connections are all refused. Pings still work. If I stop/start the instance it runs again for a few days until the problem repeats again. What should I check on the instance while I can still access it? Any ideas why this is happening? Thanks

  • 2
    A possible source is growing memory and/or swap usage. Presumably you have an application running. You can also monitor this through Cloudwatch. – Simon Greenwood Dec 27 '17 at 13:10
  • Also check /var/log/syslog for any errors after a reboot. It sounds to me like there is a process or processes that are running the machine out of resources, memory, file descriptors, etc. Re-booting resets this condition. Cloudwatch is a good call too, it will show you the instances resources and you can check to see if usage of a particular resource is growing. – Severun Dec 27 '17 at 21:15
  • Thanks for the responses. Great ideas. I will check Cloudwatch and/or add some extra metrics. – andsouth Dec 28 '17 at 15:57
  • I noticed this "cannot allocate memory" in the messages log. Dec 31 10:50:12 ip-10-1-1-99 dhclient[2251]: XMT: Solicit on eth0, interval 114080ms. Dec 31 10:52:11 ip-10-1-1-99 dhclient[2251]: XMT: Solicit on eth0, interval 120780ms. Dec 31 10:52:53 ip-10-1-1-99 dhclient[2129]: fork: Cannot allocate memory – andsouth Dec 31 '17 at 13:59
  • Cloudwatch "mem used %" metric is at 88% when these messages start. – andsouth Dec 31 '17 at 14:00

This is now fixed. I changed the instance type from T2.micro to T2.small. The memory usage is now stable at around 40% and the instance has been running for several days without losing access.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.