3

In an Amazon AWS setup, how can two cloned instances (in different regions) refer to and share the same "base" dynamic web server files and read to / write from the same main database?

Our current AMI instance is on an EBS-backed volume right now. However, apparently trying to share an EBS volume between two instances is a bad idea. I gathered that much from this older 2009 answer, but it doesn't break down what alternatives there might be, other than Amazon S3. Or is S3 the only option? Is the OPs reasoning still valid 3 years later? What are our storage options for sharing DB data live realtime by multiple instances?

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.

Community
  • 1
  • 1
dubesor
  • 327
  • 1
  • 7
  • 13

3 Answers3

3

To confirm: You're wanting to share a) the same database and b) the same files between two instances, each in a different region (not different availability zone)?

Sharing the same database across multiple regions isn't easy. Your best option is either asynchronous, multi-master replication or a manual sharding strategy. However, to do any of these safely and effectively, it has to be carefully planned and your application has to be be written with this architecture in mind. This article will give you a good overview of the caveats associated with multi-master replication with MySQL.

Sharing files across region can also be somewhat of a challenge because you have so many options, but it is generally easier than doing the same with a SQL database. Variables include:

  • How much replication latency is acceptable?
  • Are you going to be writing to both locations?
  • What kind of I/O performance do you need locally?
  • How frequently do the files change?

GlusterFS is frequently a good compromise for most use cases. However, just yesterday AWS announced a new feature that allows inter-region copies of EBS snapshots. Depending on your needs, this may also be worth researching.

jamieb
  • 9,847
  • 14
  • 48
  • 63
2

If you have an EBS-backed AMI, then each server instance will have its own "copy" of the EBS volume data that is stored in the AMI, they will not share the exact same physical volume. This is different from if your were using instance store AMI's and then mounting a specific EBS volume to each instance.

Mike Brant
  • 70,514
  • 10
  • 99
  • 103
0

Point 1) GlusterFS is good option for Multiple-Az and Multiple-regions replication. There will be some amount of replication lag during cross region replication, please be aware of this in your architecture

Point 2) if your EBS snapshot size is less and you can accommodate replication lag of few hours you can use the Amazon EBS snapshot copy feature. But this requires efforts on the destination region to detach/attach the volumes.

Point 3) S3 is still an option for this usecase

Harish Ganesan
  • 743
  • 5
  • 4