Dan C is right on the money, but I'd like to be more specific about the 1st 3 steps
For the sake of speed, and to avoid disasters, do it all in the CLI mysql client like so:
sudo mysql -e "FLUSH TABLES; FLUSH TABLES WITH READ LOCK; SYSTEM ec2-create-snapshot vol-4d826724; UNLOCK TABLES;"
I am relying on the following points:
- Acquiring the read lock can take some time if there is a long running UPDATE, DELETE, or INSERT command. I issue a preparatory FLUSH TABLES to minimize the time that any tables are locked.
- The mysql client can pass commands to the host OS with the SYSTEM command, and does so as the user running the mysql client. (That's why I used sudo)
- When you said you used ESB on EC2, which I've never used, I looked up this documentation for you. You have to look up what to put for the "vol-XXXXXXXX"
- Make your life a little easier and put a password in ~root/.my.cnf
I see this describe ambiguously, or blatantly wrong all over the internet! The documentation clearly states: "If a client connection drops, the server releases table locks held by the client.". So, you cannot open the mysql client, flush+lock, quit client, make snapshot, open mysql client, unlock tables. You will end up with an inconsistent snapshot.
Some extra-sharp readers will correctly identify that the "UNLOCK TABLES" is unnecessary, because the client connection is going to close at the end anyway. I put it in there because it makes people more comfortable.
I've cited 6 sources for you. I hope you feel confident doing this now. Let us know if you have anymore uncertainty.