I've started to fiddle around EC2, and I can't seem to understand the "AWS way" of setting up a server.
I'm using Ubuntu server 10.10 64 bit, from an official AMI by Canonical. There is an EBD drive connected to the server.
I need a standard LAMP configuration.
What I currently did (after installing the lamp stack) in order to preserve the concept of "instances are not saved when shut down" is:
- Format the additional EBS drive as XFS
- Move /var/lib/mysql, /var/log/mysql to the XFS EBS drive
- Created fstab entries for mounting these directories from the EBS drive to /var/lib/mysql and /var/log/mysql respectively
- Placed the code for the site (the Virtual Host directory) on the EBS drive
- Placed video files that the site will show in the EBS drive as well
Are all of these actions - correct (or suggested) when working with EC2 ?
Have I missed some other actions I should have taken ?
Thank you.
So, it sounds like you're doing most things by the book. The "instances are not saved when shutdown" seems like a bit of a misnomer however. It breaks down like this.. there are two types of AMI images, EBS and S3. EBS instances create an EBS Volume in your account, and that becomes mounted as part of the server instance.
S3 images are downloaded every time the server is booted, and go away when you stop it.
I only use the EBS images from Alestic for servers now, because I like to be able to stop them (not terminate), when I'm not using them, and have them come back as working when I hit start again.
EBS is a persistent data-store, and not liable to go away when you turn the server off. Think of it more like an attached hard disk.
In the past, I had an Extra Large instance, running in EBS for $work. We had 3 other EBS volumes attached at /srv. /var/lib/mysql and /var/log. (There's some performance increase to be had by having /var/log on a separate partition/drive). By doing it this way, we were able to reboot and stop/start the instance as required, without losing any data.
There's a nice review of EBS vs S3 backed instances here, that should help explain the difference, and pros/cons in terms of data persistence.