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.
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:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With