Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This is a follow up question to this post, as I'm trying to get my head wrapped around all these cloud hosting services:

Scaling a cloud-based ecommerce site

I had stumbled upon a blog and this:

Amazon Elastic Block Store (EBS) provides block level storage volumes for use with Amazon EC2 instances. Amazon EBS volumes are off-instance storage that persists independently from the life of an instance. Amazon Elastic Block Store provides highly available, highly reliable storage volumes that can be attached to a running Amazon EC2 instance and exposed as a device within the instance. Amazon EBS is particularly suited for applications that require a database, file system, or access to raw block level storage.

So it seems as though, one should connect an EC2 with an EBS. Now all that's left to be done is have your database software (on the EC2) read/write the database data files on the EBS.

AWS has so many products and they all sound pretty similar. Not sure how Rackspace and the other cloud servers have something similar or not.

I'm still fuzzy if multiple instances of EC2s can read/write to the same EBS. Or if each instance of EC2s have their own EBS and then there's some other mechanism (such as database software installed on EC2) to keep all EBSs in sync.

Also, the e-commerce platform would be Spree/Rails with PostGreSQL/MySQL database...in case someone has further insight...

Thanks!

share|improve this question

migrated from webmasters.stackexchange.com Jul 29 '12 at 18:01

This question came from our site for pro webmasters.

    
You'll get much more detailed responses from ServerFault for this question. I'm pretty sure all ec2 instances are EBS backed by default. S3 is the other storage option. I like Amazon because if an instance is turned off you're not charged other than for EBS and other services. Unlike RackSpace where if your server is offline you're still charged for allocated resources. –  Anagio Jul 20 '12 at 22:32
    
Thanks for the referral. I would have never known about server fault. –  A L Jul 25 '12 at 21:38
    
There's a nice list at the bottom of stackexchange pages. Check it out. –  Skaperen Jul 29 '12 at 18:50
add comment

3 Answers

up vote 2 down vote accepted

An EBS volume can only be used by one EC2 instance at one time. You may detach the EBS volume from one EC2 instance and attach it to another, but cannot attach it to more then one EC2 instance at the same time, please refer to Amazon EC2 FAQs for more information. For example, what I have mentioned is answered here: http://aws.amazon.com/ec2/faqs/#Do_you_plan_to_support_multiple_instances_accessing_a_single_volume

share|improve this answer
    
That FAQ answer evaded the "do you plan to" aspect of the question. –  Skaperen Jul 29 '12 at 18:32
    
Then, I would treat it as "No, we do not have such plan, you are on your own". –  Raymond Tau Jul 30 '12 at 11:36
    
@RaymondTau: I really needed someone to confirm that "An EBS volumne can only be used by one EC2 instance at one time." Thanks! –  A L Jul 31 '12 at 1:56
add comment

EBS volumes are like block devices. Most systems and software are not prepared to share block level devices. In "real life" that would be equivalent to one hard drive connected to two or more machines. Ever see that? I have not since I worked on IBM mainframes. And even when I did do programming on data shared between machines, it required a lot just to avoid corruption. The only safe way to share was to share in read-only mode. We had an out-of-band means to negotiate which machine got write access. And even with that it required a careful structure to be sure the one writer would not end up confusing any readers. While I would say it is possible to succeed with shared block devices in certain cases which are probably deeply corner cases, I would avoid it. Given the hassles end users would have with shared volumes, I can see why AWS would not expend the effort to make EBS work in a shared mode.

If you need a shared database, just build a special (probably high-I/O and/or 10-gig network) instance for it, give it the volume(s) it needs, and let it serve your other instances. Need redundancy? Set up another in a different zone or region with its own volumes and configure replication over the network.

If you need shared plain files, I guess you have to go with an instance that runs as an NFS or Samba file server.

If you need a file repository, do the same thing (an instance with its own volume(s) and perhaps also a replica in another region) and run your favorite revision storage software (git, svn, hg, cvs, whatever).

share|improve this answer
    
I was thinking there was something special about the cloud. Like these EBS were some sort of special cloud harddrives. But I guess I was expecting too much. Thanks! –  A L Jul 31 '12 at 1:57
add comment

If your database is MySQL, MS SQL, or Oracle, you're much better off using an RDS instance rather than trying to roll your own using EC2 and EBS. RDS functions like a cloud-based version of a DB server and greatly simplifies configuring and maintaining a scalable, fault-tolerant database. The underlying OS is completely managed for you so you can't SSH into it, but you can connect to it with your normal client tools to manage your database.

share|improve this answer
    
Thanks for the RDS recommendation. I was wondering at what point would that service be needed as opposed to using EBS, which now I've found out that I really can't use EBS. –  A L Jul 31 '12 at 1:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.