EC2 instance unreachable (both HTTP and SSH) after unknown amount of time

amazon ec2amazon-web-services

I have an Amazon Linux instance with only WordPress running on it (installed using Amazon guide). After some amount of time (I don't know exactly how long, at least some hours), the instance is neither reachable through HTTP (tries to open website forever) nor SSH (message: ssh_exchange_identification: read: Connection reset by peer).

When I log into the console I see that the light is green and everything seems to be ok. Even rebooting the instance won't help the problem. The only solution is stopping the instance and starting again, then the whole cycle starts again: works for some hours and then suddenly doesn't.

Maybe it's important to mention that I have purchased a reserved Linux instance matching my EC2 instance. So I'm using that. Any ideas that could help me fix this problem?

Update:
I made a snapshot of my instance and put it on a new volume, but that didn't solve the problem either.

Current security group (inbound):

  • HTTP and HTTPS from everywhere
  • SSH only from my IP

I checked access_log in httpd folder and it contains very few lines, of which a couple are weird Russian websites (sometimes). Which is weird because my website is not officially online and there is no link to it anywhere.

Best Answer

In my opinion your server or the disk has become corrupt and needs to be fully replaced. Here's what I'd do

First up, you have a choice on approach

  1. Set up a new Ubuntu 16.04 Linux server on EC2. There's an AMI so it's easy. I find Amazon Linux has less support and few packages available than Ubuntu. Use EasyEngine or similar to make this simpler.
  2. Use a premade Wordpress AMI, such as Bitnami. I think they're still on Ubuntu 14.04, but you can easily do an upgrade to 16.04.

Another choice is using RDS or MySQL on the instance. I use MySQL on the instance because it's cheaper and works just fine.

Next

  • Set up your instance to run Wordpress, if you didn't use a premade AMI. Check the basic install works before moving on.
  • Do a MySQL dump from the original server, then import the data into your database.
  • Copy your data onto the new server. This will be the wp-content directory.
  • There will be some fiddling and tweaking to get this working properly.

If this ends up being unreliable it maybe be something weird in your database. Export your posts and content via XML, then import it. I would be surprised if this was necessary.

Misc

To answer your question above, only open SSH to your own IP.

Related Topic