9
votes

So, in a simple situation, if there is only one instance, then I can store the data into a EBS volume mounted on that instance. e.g. /mnt/db

However, how does it work if I scale and have multiple instance (either static or dynamic scaling)?

Because one EBS can only attach to one instance, if I have multiple instance, does it mean that I have to attach an EBS volume for each instance? If that's the case, the data on each Instance's EBS volume will be different.

It is obvious that I want all instances to access (R & W) a single volume (as data-storage). and the data in the volume will constantly grow and there is no downtime.

What is the solution? Is there a way that I don't mount the device (EBS), and just call it for accessing the data?

Here is what I can think of: 1) if each instance has its own EBS volume, then each time interval (e.g. 1 hour), all instances will unmount & detach the EBS volume,and attach a new one. Then there is one powerful instance that mount all the EBS volumes just detached, and aggregate all the data. 2) or similar to 1), instead of detach and attach, I just take a snapshot on all volumes for all instances. Then the powerful instance aggregateness the data from the snapshot. And save the result into either another EBS or S3.

These two approach seem to be working.. but require a lot of work. is there a smarter way to approach this problem? thanks.

  • by the way, because of performance issue, I cannot have the instance writes data to S3. :)

OH how about this 3) First, all instances have their own EBS and write data into the EBS. and then each hour, data will be sent to S3. Then another instance will aggregate them.

2
This is a very good question and a part of the AWS Auto Scaling that I do not understand and came hoping for an answer. How does auto scaling work when the database is on an EBS volume? That is, how do the new EC2 instances have access to it?Skill M2

2 Answers

1
votes

how about having ang NFS instance which can be mounted to the other instances?

0
votes

It seems that you need to create an EBS snapshot of your most up to date EC2 instance. This will create an EBS backed AMI. You would then need to terminate all your EC2 instances that are not up to date and launch a new stack of instances from your newly created AMI. If you had a load balancer running then you would have to attach these new instances to your load balancer also. It seems a little long-winded but it can all be done programmatically. At least this is how I think scaling in the cloud with Amazon works and far as propagating changes across multiple instances goes. Somebody else with more experience verify this. I plan to test it out myself later on.