Postgresql – Amazon Auto Scaling + Elastic Load Balancer + Web Application

amazon ec2postgresql

Let's say I have web application that runs on a single EC2 instance (PHP + PostgreSQL). Now I create Load Balancer and set Auto Scaling.

The question is: how do I replicate database on the fly when AutoScaling starts new EC2 instance? How do I replicate files and folders of my application? And finally, how do I sync changes made on every single instance to my main instance?

Best Answer

You have to separate PostgreSQL instance from your PHP/Apache instance. And setup autoscaling for your PHP/Apache instance.

PHP/Apache instances can get sync getting files via s3,git,or svn. Or use shared filesystem like NFS.

That way you can have 1-N of PHP/Apache instance with only 1 DB.

Related Topic