Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy and update app on multiply ec2 instances in Amazon Auto-scaling group?

Could you suggest in which ways I can deploy code changes from SVN to all ec2 instances running behind Amazon load balancer in auto-scaling group? I also need to update code to latest version when a new ec2 instance launching automatically in auto-scaling group.

I suppose to use 'user-data' to run 'svn up' on new machines. And probably I could use cron to run 'svn up' periodically on all machines. Could you suggest better solutions?

like image 707
Max Chernopolsky Avatar asked Jan 09 '14 14:01

Max Chernopolsky


1 Answers

In my opinion, you shouldn't be updating code on the running instances, better to create an master AMI that has all the updated stack/code ready to go and then methodically terminate the running instances and let the auto scaling code to care of deploying new instances as needed, which will in effect deploy your new code.

You can use AWS Cloudformation for this task: http://aws.amazon.com/about-aws/whats-new/2013/02/20/announcing-new-aws-cloudformation-deployment-enhancements/

or ElasticBeanStalk:

http://aws.amazon.com/about-aws/whats-new/2013/11/11/aws-elastic-beanstalk-announces-rolling-updates/

Try googling "AWS Rolling Updates" for even more helpful links.

like image 161
E.J. Brennan Avatar answered Oct 15 '22 00:10

E.J. Brennan