views:

1437

answers:

4

We currently use multiple webservers accessing one mysql server and fileserver. Looking at moving to the cloud, can I use this same setup and attach the EBS to multiple machine instances or what's another solution?

+1  A: 

I'm fairly sure you can't, but you can clone an EBS and attach it to another instance.

This is useful for fixed datasets, or for testing on 'real' data but doesn't allow more than 1 instance to operate on a single block store

David Caunt
+4  A: 

No, this is like using a hard drive in two computers.

If you want shared data, you can setup a server that all your instances can access. If you are wanting a simple storage area for all your instances, you can use Amazon's S3 storage service to store data that is distributed and scalable.

Moving to the cloud, you can have the exact same setup, but you can possibly replace the fileserver with S3, or have all your instances connect to your fileserver.

You have a lot of options, but sharing a hard drive between instances is probably not the best option.

Kekoa
+2  A: 

No, according to the EBS docs: "A volume can only be attached to one instance at a time".

How are you using the shared storage currently? If it's just for serving files from the fileserver, have you considered setting up a system so that you could proxy certain requests to a process on the fileserver rather than having the webservers serve those files?

Austin Mills
A: 

Even if you were able to get an EBS volume attached to more than one instance, it would be a _REALLY_BAD_IDEA_.

The reason you can't attach a volume to more than one instance is that the filesystem would behave VERY badly. Most filesystems (eg, ext2/3, FAT, NTFS, etc) are written assuming they have exclusive access to the block device. Two instances accessing the same filesystem would almost certainly end in tears and data corruption.

What you need is some sort of cluster filesystem that is designed to share a block device. These are pretty rare and special.

See if your data sharing scenario can be NFS, SMB/CIFS, SimpleDB, or S3.

eg, you could attach your block device to one instance which would manage the filesystem layer and then expose that filesystem via NFS, allowing other instances access to the same files. This would likely work well for your webservers - put the website files on NFS. The big downside is that your NFS server becomes a single point of failure. Instead, you might have more luck with a cron job that kicks off rsync to keep the webservers up to date.

A similar story could be constructed for a windows instance with SMB/CIFS.

S3 usually works pretty well for storing uploaded files or big sets of large files. It's super ridiculous reliable, and you can pass back URLs that point directly to S3 resources so that users can pull the files directly.

For your Mysql data, consider using Amazon RDS. It's a managed MySql deployment that has support for multi-AZ replication so that there is no single point of failure, and can be configured to take daily backup snapshots.

ddopson