Accidentally deleted Amazon Linux EC2 home directory, my whole site blew up. How to get back up and running? [closed]

StackOverflow https://stackoverflow.com/questions/21417251

I was using sudo rm -rf to delete some folders, and accidentally deleted the /Users/ec2-user home directory. I had my EC2 and AWS Route 53 running my site, http://thinklikegeek.com. Now, it just disappeared. I have all the files for my website, but don't know how to get it back up and running well. It just says "No Data Received" if I visit my website. Help!

有帮助吗?

解决方案

This isn't an answer for how to get your files back. This answer is how to make this be no big deal the next time it inevitably happens.

You should treat EC2 instances as being disposable. That means that you fully expect an EC2 instance to go down, so you design your application and deployment strategy around that fundamental concept.

Your deployments should be from the latest copy of your source code form source control (e.g., Git, SVN), and should be 100% automated other than kicking off the process.

Next, don't store important data on the instance (unless you keep it on a persistent EBS volume). Keep the data either in S3, on an EBS volume. Enable versioning in S3, take regular snapshots of your EBS volumes.

Since there is a 100% chance of something bad happening to an instance in the future, plan ahead, and make sure you're treating your instances as disposable compute units.

其他提示

This really has nothing to do with AWS.

I'm not sure why you mentioned Route53 -- it's not lost, you can use the AWS console to control it. (including moving DNS to a new box if needed.)

In theory, there are possible ways of restoring deleted files. But it really depends on your filesystem, and takes an expert because the tools are complex. (Don't create a lot of files in the meantime, or the deleted files will be overwritten).

Your best defense is regular snapshots of your EBS drive. (Write a small shell script.)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top