4 ms·
Every EC2 instance has about 150GB of transient disk space. It works like a regular disk but once you shutdown the instance (or in the rare event the instance f
by delano 17y ago
Every EC2 instance has about 150GB of transient disk space. It works like a regular disk but once you shutdown the instance (or in the rare event the instance fails) the disk is gone forever. To solve this problem, Amazon provides EBS volumes ("elastic block storage"). These are like raw disks that you can create on the fly. You create one, attach it to your instances, give it a filesystem, and then mount it.
You can run MySQL off of the transient disk ("/mnt") but you should consider running it off of an EBS volume. One reason is because you won't lose the disk if something happens to the instance. Another is that you can use the snapshots feature to create instant backups of your database. Later on you can create new EBS volumes from a snapshot (which is really cool for building a stage environment with production data).
This may sound a bit complicated when you're just starting out. It was for me anyway so after working with AWS for a couple years I started working on a development and deployment tool for EC2. The configuration is entirely via a Ruby DSL.
You define the properties of your environments and roles with the machines DSL (including EBS volumes) and you script your repeatable processes (like deployments) with the routines DSL:
http://github.com/solutious/rudy/blob/0.7/Rudyfile http://github.com/solutious/rudy/blob/0.7/Rudyfile
If Python is more your style, there's boto:
http://code.google.com/p/boto/ http://code.google.com/p/boto/
- gsmaverick 17y agoThanks for your reply. I now understand how it all works.
- reconbot 17y agoThat's a dangerous statement ;-)
- iamelgringo 17y agoI've found it easier to think of an EC2 image's 150GB of 'disk' as RAM, and Elastic Block as an actual hard drive. EC2's disk is there when it's powered on, but when you turn it off, all data disappears. Elastic block is really EC2's hard drive. Two issues that burned me a couple of months ago with EC2 and Elastic Block: I built my server and got it running just right. I then wanted to back it up, so I bundled it (save your instance to S3) but forgot to register it(list your S3 bundle as a privately available AMI). When I terminated my instance I wasn't able to restart it, because it wasn't available in my list of registered AMI's. I had to rebuild my server from scratch. The second problem that I had was in rebuilding my database after my instance terminated. Postgres keeps the log files (transactions the database has completed) in the install folder and the data file(what the database has stored) in the storage folder. When I terminated my instance, I lost all the log files that were stored on the EC2 'disk'. I had the data file on elastic block, but the log files were gone. The standard recovery process for postgres needs log files. It took me a day to figure out how to rebuild the database from just the data files. I now have both the database and the log files on my elastic block image. Hopefully that will help the next time I kill my server. :) I also now have automated backups of everything.
- delano 17y agoYa, getting burned by EC2 is a rite of passage. I learned my lesson with Amazon's API tools. Dealing with IDs is cumbersome and dangerous when it comes to production instances. Automation is a necessity. How are you running your automated backups? Have you automated deployment too?
- kubrick 17y ago1- thx for the ruby dsl link -- I hadn't heard of it, and I can't understand why 2- the problem with using EBS comes when you have a larger DB, like, oh, 80GB or so. It takes no less than 6-8 hours to produce a snapshot of that -- I just tried it. You can do a simple rsync to another instance in like 2-3 hours. I want to like EBS but it seems ... slow.
- mindhacker 17y agoI've used EC2 for running web servers as well as database server with the db servers being replicated to rackspace for backup. I have always wondered about how EBS as disk will affect database as it is essentially a network drive. Any info on that would be great.
- psranga 17y agoYes, does anybody have data on latency and throughput of EBS "disks"?
- delano 17y agoI ran a few preliminary EC2 disk benchmarks in September: http://solutious.com/blog/2008/09/23/ec2-disk-performance-linux-solaris/ http://solutious.com/blog/2008/09/23/ec2-disk-performance-li... The Solaris performance was really poor compared to Linux. I emailed Sun and initially they were really receptive but never explained what was happening. I'm hoping to re-run the tests again soon to see if the latest OpenSolaris (2008-11) has improved.
- wiemersl 17y agoHave used ec2 and s3 for a while now in a production context. While there may be cheaper services out there, we've appreciated the ability to scale up and down rapidly, build test environments, etc. It really depends on where you are at in the cycle of a project. If you are running MySQL, and want high availability, you likely want replication, which means multiple instances no matter what provider you choose. With replication, the fact that your disk is transient isn't as big of a deal. The way I look at AWS is that it nudges you in the right direction as far as building reliable, scalable systems. As far as EBS, another thing to think about is instance types. Since EBS is essentially network attached storage (I believe), network IO greatly affects performance. Small instances don't have particularly great io. Thus, I prefer to run off the transient disk right now over EBS. If we went to larger instance types, which have better network io, that might swing the pendulum.