Block devices as a computing model is not designed for access from more than one device. The EBS abstraction of this hardware model is not capable of changing the rules of the game because the file system drivers in the overlying computing instances are still the same. They can only do magic like snapshotting because the read access in the underlying layer doesn't interfere with what the software on the system expects to be going on on a block devices. If some system other than the one EC2 instance the volume is connected to tried to change the bits on your disks directly, the file system would self destruct.
The only thing you can do that is special with EBS is use snapshots to clone drives and attach each device clone to a separate instance. This would be useful if you had a relatively static data set with only periodic updates and needed fast local access to eat from many instances.
You will need to move your sharing architecture up one level to the filesystem. There are lots of tools to do this, including shared file systems such as nfs
. Of course your performance will be limited to that of the EC2 instance you connect the device to and use as the file server.
If you require something more subtle than those two approaches, you will need to look into on of the varous distributed, replicating or cluster file systems. Also as you mentioned there are lower level synchronization tools like DRDB, but I suggest you are more likely to need a filesystem level than block level synchronization system.
For extra credit: check out some of the talk going on these days about whether block devices are ever the right model to use such as this article: Magical Block Store: When Abstractions Fail Us.
An AMI, as you note, is a machine image. It's a total snapshot of a system stored as an image that can be launched as an instance. We'll get back to AMIs in a second.
Lets look at EBS. Your other two items are sub-items of this. EBS is a virtual block device. You can think of it as a hard drive, although it's really a bunch of software magic to link into another kind of storage device but make it look like a hard drive to an instance.
EBS is just the name for the whole service. Inside of EBS you have what are called volumes. These are the "unit" amazon is selling you. You create a volume and they allocate you X number of gigabytes and you use it like a hard drive that you can plug into any of your running computers (instances). Volumes can either be created blank or from a snapshot copy of previous volume, which brings us to the next topic.
Snapshots are ... well ... snapshots of volumes: an exact capture of what a volume looked like at a particular moment in time, including all its data. You could have a volume, attach it to your instance, fill it up with stuff, then snapshot it, but keep using it. The volume contents would keep changing as you used it as a file system but the snapshot would be frozen in time. You could create a new volume using this snapshot as a base. The new volume would look exactly like your first disk did when you took the snapshot. You could start using the new volume in place of the old one to roll-back your data, or maybe attach the same data set to a second machine. You can keep taking snapshots of volumes at any point in time. It's like a freeze-frame instance backup that can then easy be made into a new live disk (volume) whenever you need it.
So volumes can be based on new blank space or on a snapshot. Got that? Volumes can be attached and detached from any instances, but only connected to one instance at a time, just like the physical disk that they are a virtual abstraction of.
Now back to AMIs. These are tricky because there are two types. One creates an ephemeral instances where the root files system looks like a drive to the computer but actually sits in memory somewhere and vaporizes the minute it stops being used. The other kind is called an EBS backed instance. This means that when your instances loads up, it loads its root file system onto a new EBS volume, basically layering the EC2 virtual machine technology on top of their EBS technology. A regular EBS volume is something that sits next to EC2 and can be attached, but an EBS backed instance also IS a volume itself.
A regular AMI is just a big chunk of data that gets loaded up as a machine. An EBS backed AMI will get loaded up onto an EBS volume, so you can shut it down and it will start back up from where you left off just like a real disk would.
Now put it all together. If an instance is EBS backed, you can also snapshot it. Basically this does exactly what a regular snapshot would ... a freeze frame of the root disk of your computer at a moment in time. In practice, it does two things different. One is it shuts down your instance so that you get a copy of the disk as it would look to an OFF computer, not an ON one. This makes it easier to boot up :) So when you snapshot an instance, it shuts it down, takes the disk picture, then starts up again. Secondly, it saves that images as an AMI instead of as a regular disk snapshot. Basically it's a bootable snapshot of a volume.
Best Answer
There is no way of direct sharing EBS between instances yet. But! There are alternatives:
The most scalable way: S3. The most complicated: distributed file systems (like GlusterFS). Somewhat between solution: 1 master node with installed lyncd and slave nodes. lsyncd manages all file updates in almost realtime mode. The drawback of this variant is that all file update operations must be done at master node.
For small projects (1-5 nodes) i'll think about lsyncd solution and for bigger ones i'll go to S3.