简体   繁体   中英

Scale amazon ec2 instance

I have amazon ec2 instance with mapped to 1 volume of data.

This instance running my http and have my server code.

now i have to scale my app with creating new instance and load balancing.

But if i create new instance with cloning existing instance how can the code and http vhost file will be in sync.

Using snapshot i close instance first time.

But i want when one instance i upload my code that should sync with other instance also.

How can i achieve this? should i need to configure rsync from 1 instance to another instance?

"Baking" custom AMIs is a very simple way to do this. Start a new instance from your AMI (start with a snapshot of your current instance), make changes on it like update application/configurations/system, test, create new AMI from it, start new instances from that new AMI, test them and then swap old instance in the ELB with the new ones.

There are also many tools you can use to automate your application deployment like Puppet, Chef or one of Amazons offerings: CodeDeploy, OpsWorks, Elastic Beanstalk and I recommend you use one such tool eventually.

From your description you cloned your first web server (www1) to make a second web server (www2).

Now when you make code edits you want the code to be in sync between the two webservers.

Rsync can help to make that easy.

From the 2nd web server (www2)

rsync -chavzP --stats username@IPorNAMEofwww1:/path/to/copy/on/www1 /path/to/putfiles/on/www2

Once you get that working from the command line. Add it to a cronjob so it syncs on a schedule (hourly). It should only sync the changes, not every file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM