Clarification on EBS volumes, snapshots, and Mercury 1.1beta

cookiesunshinex's picture


I've had a Mercury 1.1beta setup at Amazon using an AMI for a few months now. Since this box has been a development box, I hadn't bother to setup automatic snapshots. I was doing them manually from time to time.

Now that we are getting closer to something that will become production, I would like to enable automatic snapshots.

At the time I setup my first instance, which happens to be Instance Store - I followed the document "Set up EBS for Mercury" which describes how to attach an EBS volume and copy www-data and MySQL data to the attached EBS volume.

Note steps 6 and 7 are incomplete which seem to be the bits of information that I need.

I also found "Consistent EBS Snapshots for RAID arrays or single volume with Mercury"

I also found "Mercury EBS Boot Instance" which tries to tie in all of the documentation regarding EBS volumes and backups/snapshots.

However, it says "Not sure if this is needed since an EBS Boot Instance is already on EBS" when referring to "Set up EBS for Mercury" and "Move Pressflow to the EBS Volume" pages.

This page is also mentioned several times on g.d.o

There seems to be a lot of information spread in several locations, and I'm not sure which is the best way to go with this. If someone could put the commands together, I would gladly update Steps 6 and 7 in the Set up EBS for Mercury" wiki.



Use ec2-consistent-snapshot

pcoupet's picture

We use the script ec2-consistent-snapshot ( from Eric Hammond to backup attached EBS. It does what is needed to take a consistent snapshot for Mysql and the XFS file system. It works well for us since few months.

This is the command we use:
ec2-consistent-snapshot --aws-access-key-id "KEYID" --aws-secret-access-key "SECRET" --xfs-filesystem /vol --mysql --mysql-host --mysql-username "mysql-user" --mysql-password "pwd" --description "snapshot blah blah blah $(date +'%Y-%m-%d %H:%M:%S')" "EBS ID"

Few thinks to check from our experience:

  • be sure to have an XFS file system
  • The mysql user shoud have the folowing privilege: SUPER, RELOAD and REPLICATION CLIENT. (grant SUPER, RELOAD, REPLICATION CLIENT ON . TO 'mysqi-user'@'localhost';)
  • use a dedicated AWS id with restricted privileges: You have to store AWS access and secret keys on your instance to be able to run the backup in an automated way and this is risky if somebody break in. We created a dedicated IAM AWS user within a group with only one access policy allowing only EBS snapshoots. The policy fille looks like:
      Statement: [
          Effect: "Allow",
          Action: "ec2:CreateSnapshot",
          Resource: "*"