Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have various websites hosted on 1 same single EC2 instance so far. In the root EBS volume of such instance I have:
Codes and files of the websites which change every hour if not every minute Apache and PHP configuration information which I change every one to two week for on-going development e.g. modifying the virtual hosts.

I would image autoscaling works the following way:

  1. When traffic to my websites spikes and CPU ultilisation goes above 70% (my Cloud Watch settings), 1 more EC2 instances are spawned These newly spawned EC2 will have latest codes & files in my original EC2 instance During the time that the additional EC2 instances run, codes & files are kept consistent/ synchronised.
  2. When CPU ultilisation goes below 40%, additional EC2 instances are stopped/ terminated (which ever accommodate 3. below)
  3. When CPU ultilisation is above 70% again, additional EC2 instances are started (if they were stopped in 2.) or spawned (if they were terminated in 2.) with same requirements as 1.)

I've done searches and found tutorial such as this suggesting that I need to create an AMI first of all. Wouldn't I lose data consistency because of such approach? Can the AMI be created when traffic spike arises and can the data be kept consistent?

share|improve this question

1 Answer 1

Your data on your first instance will not carry over to other instances. You will have to create a custom ami and bootstrap your instances if you want to autoscale. For example, you can keep a copy of your production files on S3 and have the instances look at S3 for the files on startup and periodically after startup. For files that are changing every minute, you may want to consider hosting them outside your instances, like on S3.

share|improve this answer
    
Thanks @Edwin, what about putting data in a separate EBS volume attached to my instance(s)? I understand the architecture you recommend here but linking to S3 would be slow and overly complicated. I believe there must an easier and better way –  fuzzybee Jan 10 '13 at 10:46
1  
As far as I know, you can't attach an EBS volume to multiple instances, and even if you could, you'd have a hard time finding a file system that could handle it. I agree that it's complicated, but I haven't found that S3 is slow for serving files... If you are serving structured data from those files (like a database file), that's something different, of course. Learning and setting up autoscaling is going to be time consuming, unfortunately. But it's worth it, in my opinion. –  Edwin Jan 10 '13 at 11:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.