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

How do instances spawned from AMIs work when you have a MySQL database? I think I understand that if you have more than one instance and assign the same Elastic IP to both of them, the incoming traffic gets distributed among both. But what happens when the MySQL database gets updated on one of the instances?

I just need to wrap my mind around what happens when I create an AMI and then launch a new instance to help with traffic.

Thanks for your suggestions.

share|improve this question
    
MySQL shouldn't "just crash." Figure out why it crashed first. –  Michael Hampton Sep 4 '12 at 20:48
    
Maybe I should have said that it was terminated for running out of memory. –  Justin Amberson Sep 4 '12 at 20:56
    
Yes indeed. Add any and all possibly relevant details to your question, and you will get better answers. –  Michael Hampton Sep 4 '12 at 20:57
    
My question isn't "how do I address memory issues", it is "how does it work to have two instances, created from an AMI snapshot share the same MySQL database, or is it impossible?" –  Justin Amberson Sep 5 '12 at 0:01

2 Answers 2

up vote 2 down vote accepted

You won't generally run a separate MySQL database on each instance, but a single MySQL database (or perhaps cluster, later) to which all of your instances connect.

So at minimum you have:

Elastic Load Balancer -> Web Server Instances (on EBS or S3) -> Database Instance (on EBS)

If you need to scale the database, you can implement a MySQL Cluster in EBS instances, or just use Amazon RDS.

share|improve this answer
    
Thanks for the link, sir. This is the solution for me. Implementing it may not be easy but I will just have to try my best –  Justin Amberson Sep 5 '12 at 20:48

If your EC2 instance crashed due to running out of memory you should consider upgrading the instance to a m1.large type or at least m1.small type from the t1.micro type you currently have.

share|improve this answer
    
This does not address my question. –  Justin Amberson Sep 4 '12 at 23:59

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.