ec2-consistent-snapshot is a tool that uses the Amazon EC2 API to initiate a snapshot of an EBS volume with some additional work to help ensure that an XFS file system and/or MySQL database are in a consistent state on that snapshot.
Ahmed Kamal pointed out to me yesterday that we can save lots of trouble installing ec2-consistent-snapshot by adding a dependency on the new libnet-amazon-ec2-perl package in Ubuntu instead of forcing people to install the Net::Amazon::EC2 Perl package through CPAN (not easy for the uninitiated).
I released a new version of ec2-consistent-snapshot which has this new dependency and updated documentation. Installing this software on Ubuntu 10.04 Lucid, 10.10 Maverick, and the upcoming Natty release is now as easy as:
sudo add-apt-repository ppa:alestic &&
sudo apt-get update &&
sudo apt-get install ec2-consistent-snapshot
Once it is installed, you can read the documentation with the command
man ec2-consistent-snapshot
Screencast
Ahmed also just released a screencast which includes a quick demo of using ec2-consistent-snapshot:
This screencast walks through the steps I outlined in this article on the AWS site:
Though that paper is old in cloud years, it is still pretty much how I and many others run MySQL on EC2.


I had no trouble on Lucid -- thanks very much.
Is it worthwhile moving the root filesystem volume to XFS to allow consistent snapshots?
Cheers
Gary
Gary:
I tend to keep important data on a separate EBS volume. I often still snapshot the root volume to improve reliability, but I can always rebuild the root from scratch on a new instance, so I'm not as concerned about consistency.
That said, I am building some new application AMIs with Ubuntu on root XFS because it's not too difficult.
I have written a little wrapper script around ec2-consistent-snapshot that uses the EC2 command line tools to figure out the volume IDs for a given mountpoint - so you can invoke it with a mount point instead of a volume ID.
It also works for MD (software RAID) devices and snapshots the underlying volumes together.
Additionally, it implements a simple backup policy by cleaning up older snapshots and uses the information from /etc/mysql/debian.cnf to figure out if you have MySQL installed and running. It will then add the neccessary parameters to ec2-consistent-snapshot if the database resides under the mount point to be backed up.
See the README file at code.webfactory.de for details.
mpigulla:
Thanks! Sounds like a useful tool.