EC2 instance snapshot

amazon ec2amazon-web-servicesvirtualization

In my early days as KVM admin, when I had to do a backup of a VM image, I followed the next steps:

  1. Pause the VM
  2. Snapshot LVM volume
  3. Resume the VM
  4. Copy image
  5. Remove LVM snapshot

Now I've got some machines in EC2, but I'm facing a doubt:

Amazon official documentation says

"you should stop the instance before taking the snapshot"

but there's sometimes you can't stop a production instance.
I've been taking snapshots without stopping the instance and I've restored it (everything's gone fine) but the doubt is knocking my head time to time.

So my question is, can I pause (stop is not and option) an EC2 instance so that I can take a consistent snapshot of it?

Best Answer

Pausing is not possible. Stopping the instance will insure that your filesystems are consistent. Using fsfreeze is another method for insuring you have quiesced your filesystems.

The script ec2-consistent-snapshot is currently the de-facto standard, open source solution for doing this on Linux based instances. You can also handle MySQL filesystem backups. Running it requires AWS API permissions and it has to be run on the instance in question to insure the filesystems are consistent. I have used it with success for some time.