0

I want to host a 5 domains and 2 mySQL databases on an EC2 server. I already know the basics and can manage servers but I've never worked with EC2. I've read that when there's a shutdown or a restart, the data may get lost, so that's what I want to avoid. I can handle 5-10 or even 20 minutes of downtime every month but I don't want to have hours or days of downtime.

So far, I have this in mind:

  • Create 2 Elastic IPs for the nameservers.
  • Create an EC2 instance where I host the files and database.
  • I would install WHM / CPanel for easier management.
  • I would make off-server backups every 3 hours of everything.
  • Most of the files on the server rarely change. All images are hosted on S3 and Cloudfront, so I wouldn't mind restoring something from 3 hours ago.

Is there a way to take "snapshots" every X hours on Amazon and an easy way to restore them if the server goes down?

I assume if it does go down, all I would need to do is:

  1. Restore the snapshot.
  2. Add the IPs back to the new instance.

Am I missing something? Thanks :)

1
  • 2
    Don't use cPanel, and don't host your own DNS. – EEAA Jul 5 '16 at 4:47
0

You don't need to host your own name servers, so you don't need elastic IPs. Use Route 53 or your domain registrar name servers for DNS. Just register one elastic IP and point DNS for all domains at it. Consider putting your DNS into CloudFlare, which will provide some protection against attacks, and can also be a CDN/Cache. They have a free tier.

Use EBS snapshots for backing up your data. If you want to backup offsite it's more difficult. I backup using Attic, and I use use a Dropbox script to get it off the server. You can easily script regular EBS snapshots, they're differential backups so disk use is minimal. Every three hours is verging on excessive unless the data is critical, I do mine monthly. If your data is really critical you should probably look at having servers in different availability zones.

You only lose instance storage when you stop or terminate your instance, not when you reboot. However if the server stops for some unknown reason, like hardware failure, you can lose the instance store. Don't use instance storage for anything that isn't persisted, use EBS. If your server stops you simply start it, but a server stopping would be rare.

You could also use the AWS Elastic File System, if you want a shared file system between your instances. This could be good for things like PHP scripts, images that are uploaded, etc, it's easier to work with than S3.

2
  • If you're happy with the answer please use the check mark to accept it – Tim Jul 5 '16 at 9:10
  • "You only lose instance storage when you reboot" is incorrect. The contents of the instance store volumes persist across reboots. Only Stop/Start, Terminate, or of course physical machine failure should cause loss of the instance store. – Michael - sqlbot Jul 5 '16 at 11:49

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.