Hi I am running a large ec2 ubuntu instance which is configured for auto scaling. Whenever the load increases on the large instance it will boot a new instance. But the booted new instance will not have updated code. I have my code repo in github. How to I configure the newly booted instance to pull the code from the github and keep itself updated.
Please give some heads up
Ubuntu's EC2 images support
cloud-init
, which is intended for this sort of thing. It lets you run scripts, install packages, configure the system, etc. and is well supported by AWS.If you want to execute some command after booting up your Linux instance, you can add the needed command to
/etc/rc.local
. This script gets executed at the end of boot process. So, you can pull the code from github automatically each time a new instance is booted.This is indeed possible. You might want to look at the following thread which gives some really useful information on the topic:
http://lists.opscode.com/sympa/arc/chef/2011-07/msg00110.html
I'd do something like this crontab w/
it will execute your "git pull" every time your instance boots.