I have an EBS backed EC2 running instance. The EBS store holds a database. I would like to create an AMI from this. Can someone please provide guidelines?
- Do I have to shut down MySQL?
- Will my AMI attempt to connect to the same EBS store?! (disaster)
- Will creating the AMI automatically snapshot my EBS volume and create a copy? (hoping it’s this one)
Thanks for your patience through a long question. I recognize there’s similar information out there, but nothing really addresses what may go wrong.
This SO question:
is specific to ElasticFox and I’m not using any tools (prefer command line). I don’t believe the question is answered either.
This blog:
http://instantbadger.blogspot.com/2009/09/how-to-create-and-save-ami-image-from.html
while instructive about creating an AMI, does not mention EBS at all and I’m a little worried about all that data.
Thanks in advance!
Before going to your questions I would suggest that you back up your MySQL database to a file which is not stored as a snapshot or in an EBS before you start creating the image. (And of course test that you can restore it to somewhere else than your production system.)
I use:
to backup and:
to restore.
A bit more info:
I prefer to shut down the database when possible when snapshoting or creating images. That said I am not by any mean an MySQL expert, but here is some guidance from http://aws.amazon.com/articles/1663?_encoding=UTF8&jiveRedirect=1
Start a MySQL session on the instance, using the password you set above.
In the mysql session, flush the tables to disk and acquire a lock. Flush the file system to disk and freeze it. Do not exit the MySQL session or you will lose the lock and snapshot potentially inconsistent database files!