AWS EC2 Instance Ubuntu Server Wordpress Full Backup

So this week I have learned some things the hard way unfortunately. I have a T2.Medium EC2 Instance on a Ubuntu Server. I had decided to upgrade from Ubuntu 14.04 to 16.04

I am a newbie but have some experience in this. I thought I had done this right and I made a snap shot of my volume image weekly.

Well after I have no idea what exactly happened but I could not access or repair my WordPress website after I upgraded. So I thought I would open a new instance using my AMI snapshot. But this didn't work either as the new instance was also the new 16.04 ubuntu.....

So my question is I know the newer version is better for security reasons and more but

how do I make a complete back up of my system so this happens again I can revert back and work on the solution on the side until I am sure the new upgrade works 100%?   And yes I know I should had done this the first time but lesson learned.
LVL 1
Dustin StanleyEntrepreneurAsked:
Who is Participating?
 
Justin CAWS Solutions ArchitectCommented:
The use case you're describing, being able to quickly launch a "backup" and continue with an exact copy of your instance, would probably be best accomplished by creating AMI's of your instance often.  A snapshot is a volume level "backup" and is incremental, as in the first one is a full copy of the volume, additional snapshots capture only changes since the last one, etc.  Using snapshots, you can create a new volume which will be a copy of the original, but you must then attach it to an existing instance to access the data.  

AMIs are a complete copy of the instance and you can launch a new EC2 instance directly from that image. I am not sure what you mean by a snapshot of the entire instance, or why, if you are using snapshots, it doesn't contain the current data (from the time of the snap anyway).  Try creating an AMI and spinning up a new instance from it to ensure it works as you anticipate.

EDIT: You are using an EBS-backed instance, correct?  If not and you are using what AWS terms "instance store" storage (non-persistent storage), you will lose any changes you've made to the instance any time it is stopped.
0
 
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
If you have a standard WordPress install (WordPress .php files + database), then use one of the many backup plugins.

My choices...

https://wordpress.org/plugins/duplicator/ - great free plugin.

https://ithemes.com/purchase/backupbuddy/ - very full featured paid plugin.

If you're running a huge amount of additional custom code outside WordPress which has to... be included in each backup or you have complex tunings, likely best to run LXD + backup the entire container, so you have bootable image you can transfer between machines.

BTW, if you have your WordPress files + database (even if just raw /var/lib/mysql/* files), your site is still recoverable.

I can't tell you how many times I've taken on new clients in this situation + recovered their entire systems. Sometimes with 100s of domains running.

All you require is a restored backup or the ability to boot into single user mode + you can recover your site.

Lots of good guides online or just hire someone who does this every day.

So your site's still there + recoverable.
0
 
Dustin StanleyEntrepreneurAuthor Commented:
Thank you for the help. I went ahead and did a fresh install of WordPress on the new instance. I still have my old instance.

I had woocommerce and around 40,000 products. You say if I have my raw /var/lib/mysql/* files then it is easily recoverable. Would I FTP through FileZilla and SSH and copy these files to the new instance for a quick recovery.....Would that work?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Dustin StanleyEntrepreneurAuthor Commented:
Also in addition to my last comment. I thought the snapshot was a full backup. What does Amazon offer as a full backup up of the machine? Thanks for the help.
0
 
Justin CAWS Solutions ArchitectCommented:
You mention snapshots, which are EBS volume-level incremental backups, and AMIs, which are complete point-in-time images of an EC2 instance AND ALL attached EBS volumes.   Which did you take prior to trying to restore your instance?  They are two separate concepts.
0
 
Dustin StanleyEntrepreneurAuthor Commented:
@Justin C

Well as you see i am not 100% good with the understanding or vocabulary. But I took a snap shot of my instance. I have been able to recover most of the information I needed but it isn't 100% back yet. What I need to understand is what exactly do I have to do to make a 100% complete backup of my EC2 System.

As in a complete back up I mean the server and everything. Such as the current software versions and applications on the server. So if this happens again i can just launch from a back up very quickly. I thank you all for the help.
0
 
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Maybe you're thinking only in terms of a backup, rather than how you'll restore your backup.

This is a common problem I have with new clients.

Just because you make a backup, doesn't mean you have anything you can restore.

I only consider a backup procedure good, if I can restore that backup to a running system.

Because of the questions you're asking, I'm guessing your best choice will be to use Duplicator or BackupBuddy, as these produce simple .zip files which can be restored on another machine + produce a running system.

Amazon Snapshots sound like bitwise OS copies. If this terminology is alien to you, then it's unlikely you'll be able to restore this to a working system.

If you work with /var/lib/mysql/* raw files, then you have to know what you're doing. For example, you must completely shutdown mysql before you backup these files or you'll have corrupt files.

As I said, based on your questions, stick with my initial comment, to ensure you have a restorable backup.
0
 
Dustin StanleyEntrepreneurAuthor Commented:
Thanks for the Info. I will see what I can do with the AMI and plugins.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.