In the article Running MySQL on Amazon EC2 with Elastic Block Store I describe the principles involved in using EBS on EC2. Though originally published in 2008, it is still relevant today and is worth reviewing to get context for this article.
In the above tutorial, I included a sample script which followed the basic instructions in the article to initiate EBS snapshots of an XFS file system containing a MySQL database. For the most part this script worked for basic installations with low volume.
Over the last year as I and my co-workers have been using this code in production systems, we identified a number of ways it could be improved. Or, put another way, some serious issues came up when the idealistic world view of the original simplistic script met the complexities which can and do arise in the brutal real world.
We gradually improved the code over the course of the year, until the point where it has been running smoothly on production systems with no serious issues. This doesn’t mean that there aren’t any areas left for improvement, but does seem like it’s ready for the general public to give it a try.
The name of the new program is ec2-consistent-snapshot.
Features
Here are some of the ways in which the ec2-consistent-snapshot program has improved over the original:
Command line options for passing in AWS keys, MySQL access information, and more.
Can be run with or without a MySQL database on the file system. This lets you use the command to initiate snapshots for any EBS volume.
Can be used with or without XFS file systems, though if you don’t use XFS, you run the risk of not having a consistent file system on EBS volume restore.
Instead of using the painfully slow ec2-create-snapshot command written in Java, this Perl program accesses the EC2 API directly with orders of magnitude speed improvement.
A preliminary
FLUSHis performed on the MySQL database before theFLUSH WITH READ LOCK. This preparation reduces the total time the tables are locked.A preliminary
syncis performed on the XFS file system before thexfs_freeze. This preparation reduces the total time the file system is locked.The MySQL
LOCKnow has timeouts and retries around it. This prevents horrible blocking interactions between the database lock, long running queries, and normal transactions. The length of the timeout and the number of retries are configurable with command line options.The MySQL
FLUSHis done in such a way that the statement does not propagate through to slave databases, negatively impacting their performance and/or causing negative blocking interactions with long running queries.Cleans up MySQL and XFS locks if it is interrupted, if a timeout happens, or if other errors occur. This prevents a number of serious locking issues when things go wrong with the environment or EC2 API.
Can snapshot EBS volumes in a region other than the default (e.g.,
eu-west-1).Can initiate snapshots of multiple EBS volumes at the same time while everything is consistently locked. This has been used to create consistent snapshots of RAIDed EBS volumes.
Installation
On Ubuntu, you can install the ec2-consistent-snapshot package using the new Alestic PPA (personal package archive) hosted on Launchpad.net. Here are the steps to set up access to packages in the Alestic PPA:
codename=$(lsb_release -cs)
echo "deb http://ppa.launchpad.net/alestic/ppa/ubuntu $codename main"|
sudo tee /etc/apt/sources.list.d/alestic-ppa.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BE09C571
sudo apt-get update
Once this is set up, you can install and upgrade packages in the Alestic PPA just as you would with any other Ubuntu package. Here’s the command to install the ec2-consistent-snapshot package:
sudo apt-get install -y ec2-consistent-snapshot
This will also install all of the dependency packages except for the Net::Amazon::EC2 Perl module which does not yet have an Ubuntu package. You can install this with the command:
sudo PERL_MM_USE_DEFAULT=1 cpan Net::Amazon::EC2
Now you can read the documentation using:
man ec2-consistent-snapshot
and run the ec2-consistent-snapshot command itself.
Feedback
If you find any problems with ec2-consistent-snapshot, please create bug reports in launchpad. The same mechanism can be used to submit ideas for improvement, which are especially welcomed if you include a patch.
Other questions and feedback are accepted in the comments section for this article. If you’re reading this on a planet, please click through on the title to read the comments.


Thanks a lot for a great script and easy to follow instructions. It worked for me out of the box. The script returns very fast, I had to list the snapshots to make sure it actually worked.
Can you share some thoughts:
1. on how frequently you run
2. how many snapshots to keep
3. is it ok to delete any snapshots (they are incremental, no?)
Thanks again for all your contributions to the community.
Marius
Thanks for this script. Is there something like this for postgres ? Thanks would be awesome;)
lov2cod: Glad it's working for you. The frequency and expiration of snapshots is a personal decision based on a number of factors I can't cover in a comment. There is a limit of snapshots per account which can be raised by request. Deleting snapshots is fine and won't cause any problems even though they are in a sense incremental.
bwaltherb: As I understand it, the folks using this program to snapshot PostgreSQL databases are depending on the natural crash recovery in that software when restoring EBS snapshots. MySQL InnoDB has similar features, but the FLUSH/LOCK reduces recovery time. If there are specific steps to take to improve the reliability and recovery of PostgreSQL, I'd be happy to add the option to this package.
Thxs for the answer.
Another general question: Why do you not just do a mysqldump and then store the dump in to the EBS volume? After that run the snapshot.
Is there a big time advantage to do it with storing the data files directyl in the EBSEBSvolume? When the machine crashes you need to recover from a snapshot anyway and not from the EBS right?
Besides I am generally wondering what data are best stored in EBSbesides database data, e.g. /var/log ? /home ?
And another one: As far as I saw you cannot increase an attached EBS - you would have to reattach a new one an move the stuff correct?
Thanks a bunch
bwaltherb: An EBS snapshot of a volume with the binary database files can be the source for a new EBS volume which can be used by a new database server. You don't need to wait for the database to be loaded from a dump file. An EBS snapshot is near instantaneous to initiate.
You can use EBS to store anything which should be persistent beyond the lifetime of a single instance. If the instance crashes, you can generally attach the EBS volume to a new instance and resume your work.
Resizing a file system residing on an EBS volume involves creating a new EBS volume. There are ways to speed up this process and reduce downtime.
You may need to install 'make' before installing the Net::Amazon::EC2 perl module.
Thanks for sharing your considerable experience!
A minor problem I had in the instructions above. The key identifier didn't work:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BE09C571
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv-keys BE09C571
gpg: requesting key BE09C571 from hkp server keyserver.ubuntu.com
I need to interrupt it after about 30 seconds.
Subsequently apt-get update complains of a missing key:
W: GPG error: http://ppa.launchpad.net hardy Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0EC7E508BE09C571
But I can recover by replacing the BE09C571 in the original command with the 0EC7E508BE09C571 in the error message:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0EC7E508BE09C571
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv-keys 0EC7E508BE09C571
gpg: requesting key BE09C571 from hkp server keyserver.ubuntu.com
gpg: key BE09C571: public key "Launchpad PPA for Alestic" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
Shlomo: Thanks for reporting this. The keyserver.ubuntu.com server has been having a bit of trouble the last couple days, not specific to any particular key id. It looks like you caught it at a bad time then tried it again when it was working.
Eric, does the key id shown in your code BE09C571 work for you? I still get the same "stuck" behavior. When I use the full key id (from the subsequent error message) 0EC7E508BE09C571 then the keyserver works.
Or, am I reading too deeply into the key id, and both ids should work but one doesn't (for me)?
The help message in the script is missing a description of the --mysql-host option. Something like this:
Name of the MySQL host whose data directory is on the specified volume(s). Defaults to "localhost".
Shlomo: Both key ids work for me.
Please report bugs (no matter how small) here so they can be tracked:
https://bugs.launchpad.net/ec2-consistent-snapshot/+filebug
I'm having a lot of problems installing this wonderful (at least it appears to be) util.
yesterday I had some problems with the key. Today I've the key but when I launch PERL_MM_USE_DEFAULT=1 cpan Net::Amazon::EC2
It stucks at various points. Sometimes searching for a ftp file and sometimes selecting a country. ¿This has something to do with I'm launching it from Europe (Spain)?
Thanks in advance
My installation stucks at this message launching cpan:
(1) Africa
(2) Asia
(3) Australasia
(4) Central America
(5) Europe
(6) North America
(7) Oceania
(8) South America
Select your continent (or several nearby continents) []
Sorry! since you don't have any existing picks, you must make a
geographic selection.
I'm from spain, so my availability zone is eu-west-1, maybe this has something to do with.
How does one retrieve and install this on Debian?
eduardo: What AMI id or Ubuntu release are you running?
konsl: I don't use Debian, but since this tool is written in Perl it should work without modification. You might be able to download the .deb file from the PPA and use "dpkg -i" to install. Or you could just copy the single script file from the Bazaar source code repository and install the dependencies from CPAN. If anybody figures out a simple recipe to install on Debian or any other distro, help out the community by posting it in a comment here.
Hi,
I am just curious -- why have you built packages for different archictectures? It looks like this is a perl script, so you should be able to make a single package for architecture "all" and have it install on every architecture, right? That's how most perl/CPAN packages are built...
zarzavin: In the Launchpad PPA I publish packages for different Ubuntu releases (Dapper, Hardy, Intrepid, Jaunty, Karmic) not different architectures. I'm new to PPAs, but this seemed like the preferred approach until somebody points me in a different direction.
If by "architecture" you meant Ubuntu vs. Debian vs. CentOS, then I'm not aware of any single way to release packages which integrate easily with all of their package management systems.
I would like to see support for Debian added to the Launchpad PPA facility since Ubuntu and Debian use the same package structure. There is a bug report requesting this, but I don't know if the Launchpad developers have any incentive to implement it.
CPAN is not easy to use for non-Perl programmers and the goal of ec2-consistent-snapshot is to be usable by everybody, even non-programmers.
I'm considering turning this into a CPAN package as well, since I'm already a CPAN author. The goal there would be put all of the serious logic into a Perl package which programmers could plug into their applications. Then the ec2-consistent-snapshot command would be a simple wrapper to call the package methods.
Eric,
By architecture I mean "i386", "amd64", etc. Since your package is essentially plain text, you don't need to assign any architecture to it and don't have to publish separate .deb's for each release -- make the package for the architecture "all". It's just a matter of adding a line to your "debian/control" file;
http://tldp.org/HOWTO/html_single/Debian-Binary-Package-Building-HOWTO/#AEN92
A CPAN package would be great as well!
zarzavin: I see what you mean now. This is being done automatically by Launchpad, so I didn't even notice it.
http://ppa.launchpad.net/alestic/ppa/ubuntu/pool/main/e/ec2-consistent-snapshot/
I'm changing debian/control architecture from "any" to "all" and perhaps the next build will take care of it.
I'm using a customized AMI over one of yours (but now I can't remember) Uname -a tells mee "Linux version 2.6.21.7-2.fc8xen (mockbuild@xenbuilder1.fedora.redhat.com) (gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)) #1 SMP Fri
Feb 15 12:39:36 EST 2008"
If further info required, just tell me what should I type
eduardo: lsb_release -a
In case anyone is curious about installation on Debian, I was able to install without any hitches by using
followed by to install the necessary dependencies. The Net::Amazon::EC2 CPAN module also had to be installed.Is this script a good choice/usable if I'm not using MySQL on the EBS?
brandon: The ec2-consistent-snapshot software adds the most value if you are using MySQL and/or XFS. Otherwise, the main differences between this and the ec2-create-snapshot command include:
1) ec2-consistent-snapshot uses the AWS access key id and AWS secret access key (short strings) while ec2-create-snapshot uses the AWS certificate and AWS private key files.
2) ec2-consistent-snapshot tends to run faster than ec2-create-snapshot (1+ second vs. 4+ seconds).
Forgive me for what may be a simplistic question -- I'm new at this. Since this script a) requires your AWS credentials, and b) must be run from an EC2 instance, what's the standard way of automatically getting your credentials installed on the instance? Assume that ec2-consistent-snapshot will be run automatically on an instance that was provisioned, perhaps by autoscaling.
>>Reply to "eduardo: lsb_release -a"
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 8.04.3 LTS
Release: 8.04
Codename: hardy
Maybe I've not explainde properly my situatio. The message asking me for a Continent, the messages repeats quickly filling my terminal windows. It's in a loop asking me for the continent.
Thanks in advance
eduardo: I was able to reproduce your problem on Ubuntu Hardy. The documentation in the ec2-consistent-snapshot package has been updated with a fix. It basically comes down to using the following on Hardy:
sudo apt-get install -y build-essential
sudo cpan Net::Amazon::EC2
myles: There has been a lot of discussion about how to handle operations on an EC2 instance which require secret keys and no single satisfying answer. Folks seem to use one or more of: store keys in a private AMI; pass keys in through user-data; scp keys in from an outside host; perform operations on an outside host (perhaps at the request of the EC2 instance using a different secret); using different keys to start the instance and to perform the operations, if possible (SimpleDB, SQS, S3).
Eric, does this script write to a log when the snapshot is complete? If not, does anyone know if there's a way I can check for a successful snapshot and then write to a log?
Yeah, I was trying to avoid things like rebundling AMIs because:
a) leads to higher cost for me
b) makes it harder for me to just switch AMIs when they're released.
I also wanted to avoid doing anything that required shipping OTHER keys somehow, like we would need for grabbing them from S3, etc.
Passing them in through user-data seems like the best idea. Thanks!
vaughnhannon: The program has various levels of output which you are welcome to parse and/or send to a log file with standard Linux redirection or pipes.
Yer, I'm currently building a similar set up for a Postgres database and Rails application volumes. Most people will be taking simple LVM or similar snapshots with a Postgres data volume and allowing the Write Ahead Log system in Postgres to do a recovery. You will still want to do a freeze with this if you have a plain XFS partition though as a LVM snapshot will do this internally. Don't use xfs_freeze with LVM snapshots. I don't know of any other filesystem that does an explicit freeze with a userland tool like XFS. Correct me if I'm wrong.
This works pretty well, it's something I've been doing for a long time now and it's a great Postgres feature. It's even meant on one occasion that there has been a serious hardware crash and I've simply remounted the volume to another system, started Postgres and got working. You can also throw a compatible system together, connect the snapshot and have a throwaway test system.
Do you know what the state of play is with XFS and various AMIs Eric? I had heard a while back that there was some trouble with EBS, XFS and various kernels AMIs were using. However, I've got some modified Gentoo and CentOS images with the XFS module already bundled and these all seem to have standardised on a FC8, 2.6.21 Xen kernel. Your Ubuntu images seem to use the same.
The state of XFS, AMIs, and kernels was stable for months, but has recently been in a bit of flux with the latest kernels. You can monitor the situation:
http://groups.google.com/group/ec2ubuntu/browse_thread/thread/cfca179e77a880f
http://developer.amazonwebservices.com/connect/thread.jspa?threadID=37436
This script is a beautiful thing. A minor detail: the script chokes if you have quotes around the username and password in .my.cnf. This took a little while to figure out, but of course there's no reason the quotes have to be there.
johan: Thanks for reporting this. I've submitted a bug report:
https://bugs.launchpad.net/ec2-consistent-snapshot/+bug/454184
Eric,
I think the information you provide here is wonderful. Have you looked at the AWS Perl program by Tim Kay?
The only dependency is Curl.. that's it. I remember when I was banging around on AWS a few years ago and trying to use the Amazon Perl packages.. the dependencies were an immense headache (somehow I overlooked his package.. or maybe it was too new).
He has it up on GitHub as well.. would be great if you joined forces to make the most dominant AWS package on the planet (It currently supports many S3, ec2, elb and sqs commands). I'm trying to read through the Perl code, but it is way beyond my Perl reading abilities:
http://github.com/timkay/aws
Here's the amazon page for it:
http://developer.amazonwebservices.com/connect/entry.jspa?externalID=739&categoryID=85
Some of his documentation is lagging the features he's adding.. so it's hard to tell what can be done.. but most ec2 commands are supported.. you can do s3put s3mkdir, s3rm etc.. you can do elastic load balance stuff.. you can make snapshots..
eli: Yes, I use Tim Kay's "aws" program regularly. There are a lot of different ways do do things with AWS/EC2/S3 and many different tools. I've tried to stay away from favoring one over another in the base install AMIs I publish. The easier the tool publishers make it to add them to a running system, the better for the users. For example s3cmd is already an Ubuntu package so it's very easy to install.
I would like for Jeff Kim's Net::Amazon::EC2 Perl package to be simpler to install. I hear that it's a matter of asking the right Debian developers to add it to the list of supported CPAN packages; pointers to how to do this would be appreciated.
Eric,
Does any tool come close to covering everything or is one sort of stuck installing multiple tools to manage everything from EC2 to S3 to Elastic Block Stores?
It would be nice to see something rise to the top and provide all the commands needed to manage all of one's Amazon Web Services stuff..
Also, I can see that there are two ways to approach managing your aws environment..
Command Line (using the Tim Kay "aws" code for example) and treating all of AWS as a direct extension of the OS.. deleting S3 buckets.. cranking up AMI instances.. attaching EBS volumes.. making snapshots.. in the same way one might mkdir and ls (short commands, easy to type.. etc).
Or the more powerful (but also more complex) method of writing full code using Ruby, Python, Perl or Java.
Or well.. three ways.. the third being a mixture of both. :)
Anyway, thanks for the great information you create.. you are a tribute to the Internet.
eli: One cool thing about AWS implementing everything as a "web service" protocol is that it opens the field for competition making the best tools/UIs to control the resources. Different types of interfaces work for different people. In fact, I use a handful of different ways of interacting with AWS depending on the particular task I'm trying to accomplish. California wouldn't be where it is today without a bit of the Wild West chaos.
Hello, I just read your comment post and that is exactly what I still have on my todo list. I am fairly new to the postgres admin and looking for references to learn how to do consistent snapshotting with postgres. Can you maybe help me out maybe with some references where to start? Cheers
I get an error message when running the program, but the snapshot seems to be created. Any thoughts on what's causing this, how to avoid it, or if it's a real problem?
ec2-consistent-snapshot: master_log_file="mysql-bin.000459", master_log_pos=106 ec2-consistent-snapshot: ERROR: create_snapshot: Attribute (description) does not pass the type constraint because: Validation failed for 'Maybe[Str]' failed with value HASH(0x2268380) at /usr/local/share/perl/5.10.0/Net/ Amazon/EC2.pm line 731 Net::Amazon::EC2::create_snapshot (undef, 'VolumeId', 'vol-da999999') called at /usr/bin/ec2-consistent-snapshot line 134 eval {...} called at /usr/bin/ec2-consistent-snapshot line 132 main::ebs_snapshot('ARRAY(0x1811748)', undef) called at /usr/bin/ec2-consistent-snapshot line 88 Snapshots: 1I was expecting the mysql host to be picked up from the .my.cnf, in the same way it picked up the mysql user and pass from there. So for now I'm just passing the host as a parameter.
Just thought you should know.
Thanks for a great script.
I'd also like to let you know I have the same problem as the poster at Nov 18 7:06. Here is the output I get (but yes, the snapshot appears to be created):
ec2-consistent-snapshot: ERROR: create_snapshot: Attribute (description) does not pass the type constraint because: Validation failed for 'Maybe[Str]' failed with value HASH(0xa6cd410) at /usr/local/share/perl/5.10.0/Net/Amazon/EC2.pm line 731
Net::Amazon::EC2::create_snapshot(undef, 'VolumeId', 'vol-9999999') called at /usr/bin/ec2-consistent-snapshot line 134
eval {...} called at /usr/bin/ec2-consistent-snapshot line 132
main::ebs_snapshot('ARRAY(0xa0eafd0)', undef) called at /usr/bin/ec2-consistent-snapshot line 88
@marsrc: How did you pass in the host name? I added the switch --mysql-host localhost but still get the same error.
marsrc: The warning message problem has been corrected in the latest release of ec2-consistent-snapshot if you upgrade from the Alestic PPA.
Eric,
When you have RAID'd EBS volumes underlying the filesystem holding your data files, how do you keep track of which snapshot ID corresponds to which RAID segment and which snapshots go together to reconstitute a filesystem?
Right now, it looks like the snapshot ID gets printed to STDOUT (unless suppressed by $Quiet) and that the onus is on the caller to capture that output. Perhaps it'd be preferable to pass the ebs_snapshot sub a handler class with callbacks for success and fall cases. The default handler class could be implemented with the current STDOUT but it'd provide users with the ability to specify implementations that store snapshot outcomes to a file uploaded to S3, a SimpleDB domain or whatever.
eli,
My favorite API for consistent AWS usage is boto (see http://code.google.com/p/boto/). It's python but as long as you're OK with that, I think it's nicer than ad-hoc libraries. For ruby, RightScale's right_aws library is similar. I don't know of a perl analog though.
Since the last update of ec2-consistent-snapshot I'm getting this error when it runs:
ec2-consistent-snapshot: ERROR: create_snapshot: The following parameter was passed in the call to Net::Amazon::EC2::create_snapshot but was not listed in the validation options: Description
at /usr/local/share/perl/5.10.0/Net/Amazon/EC2.pm line 707
Net::Amazon::EC2::create_snapshot(undef, 'VolumeId', 'vol-9d1ce1f4', 'Description', 'ec2-consistent-snapshot') called at /usr/bin/ec2-consistent-snapshot line 136
eval {...} called at /usr/bin/ec2-consistent-snapshot line 134
main::ebs_snapshot('ARRAY(0x9e64e50)', undef, 'ec2-consistent-snapshot') called at /usr/bin/ec2-consistent-snapshot line 90
Any thoughts on what might cause this?
Thx.
V
veeyawn: Please upgrade the Net::Amazon::EC2 package using a command like:
sudo cpan Net::Amazon::EC2
Awesome Eric, thank you.
Hi, Eric:
With amazon announcing rds and making a key selling point of it that it offers snapshotting capabilities, how would you compare and contrast your ec2-consistent-snapshot from what amazon offers within its RDS offering?
Currently I have my own ec2 instance running mysql5.1 and am thinking of deploying your script.
But if there were a significant advantage to going in one direction or another, I am able to do so while we are still in our alpha stage....
Thanks in advance,
- Bill
Eric,
Someone at amazon ec2 forums reported seeing data loss on their mysql db where the data folder was resident on an ebs volume. The relevant thread is http://developer.amazonwebservices.com/connect/thread.jspa?threadID=39448&tstart=0
Have you heard of this? I was planning on following your instructions and setting up mysql on the ebs volume but now I am wondering if this is an isolated incident (perhaps engendered by operator error) or something that you and others perhaps have noticed?
Thanks,
Bill
Bill: RDS certainly looks simpler than maintaining your own instances, EBS volumes, and snapshots. I haven't tried it yet since it looked like it required selecting a two hour window each week for possible maintenance and I don't want my sites to go down that often. I also run in master/slave configurations which are not yet supported by RDS. I do a number of configuration changes to make MySQL perform better for my applications and don't know if Amazon's DBAs are going to take quite as much interest in my particular databases, if they configure everything to perform far better than I could. If I were starting fresh, I might consider RDS, but since everything is already in place, I don't have a lot of incentive to switch yet.
Bill: Yes, I saw that thread, but it is difficult to diagnose a report of "missing data", especially when I know how easy it is to accidentally not have a volume attached, or not mounted, or the wrong volume, or on the wrong instance, or... In any case, I believe in multiple backup strategies not just to protect against potential EBS issues (and they do have a failure rate as a block device) but also against human error (which has an even higher failure rate).
Eric....Thanks for your responses! Much appreciated!
Couple requests.
1. Support for more than 1 EBS mount point. We have 10 volumes mounted on /data and /mnt2 has some additional info. Both are XFS filesystems and can be locked. Maybe ability to Lock the database and run an external script? That would allow us to change /etc/my.cnf too.
2. Support for yum for CentOS 5?
3. Email on error?
4. Ability to store in the description the mounted partition. I.e. "/dev/sdi", "/dev/sdi1", "/dev/sdi2". etc. That helps a lot when bringing up a new version.
billnbell: Thanks for the feedback.
1. I run ec2-consistent-snapshot once for each EBS volume mounted. Does this not work for you? Do you have multiple file systems per volume?
2. I'm not a CentOS/Fedora/RHEL developer, but the ec2-consistent-snapshot is published under the Apache 2 license, so feel free to package it up for your favorite distro and make it available. It would be nice to always keep it up to date with the latest releases, though.
3. If you're running ec2-consistent-snapshot from cron, you can use the --quiet option and it will only send you cron email on an error. Otherwise, I'd recommend creating a generic wrapper which can implement this functionality with any shell command, perhaps through pipe input.
4. I'll think about adding this in the default. In the meantime, you can specify your own --description string when invoking ec2-consistent-snapshot.
Eric, thanks for the script (and your previous response to my question); we've been using it for a month or so now, and it seems o be doing great.
Have you considered adding the ability to do grandfather-father-son (as it's apparently called) rotations on the snapshots? Something like: http://www.bermita.com/snapback.html
That's what we're looking at doing now, and I could file a wishlist bug if that's something that sounds interesting to you.
Thanks again!
brandon: I've tried to stay out of the snapshot expiration business with ec2-consistent-snapshot, focusing on doing one thing well and letting folks implement their own expiration policies and procedures. If there are specific hooks that would help implement these, then I'd be interested in adding them. I think a lot can be done with passing in an appropriate snapshot --description value and/or saving the snapshot id returned from the program.
I am complete newbie when talkin about amazon. Still, i have a quick question.
Can i use this to backup an partition(ebs) even if it has more than db data? Like images, or mp3s.
Marcelo: Absolutely, you can store anything on an EBS volume and the snapshot backs it all up.
I installed the ec2-consistent-snapshot program and have a question related to the filesystem. I am using ext3 filesystem and would like to know of any risks using this program to backup the EBS volume.
John: The risk with EBS snapshots of ext3 is that you never know if your application and file system changes have been flushed out the the EBS volume block device or not. This means that you don't know if you will have a consistent file system or the latest data when you restore. Most of the time it will work just fine because changes are generally flushed to disk fairly quickly. I like a little more certainty which is why I use XFS on EC2 EBS volumes.