Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 6 down vote accepted

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.

share|improve this answer
let me try cloud-init and get back to you – Jeevan Dongre May 8 '12 at 14:49

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.

share|improve this answer
Can I config it in the large instance since the newly booted instance will be the replica of that instance – Jeevan Dongre May 8 '12 at 13:55

This is indeed possible. You might want to look at the following thread which gives some really useful information on the topic:

share|improve this answer
Please edit your answer and provide relevant content here. – EEAA May 8 '12 at 15:29
I don't know what you mean by editing my comment - I found all answers on the opscode mailing lists when I was setting this up for myself - so if you could read through it you'd find out tons of information. There is no easy answer but one of the contributors to the discussion posted a step by step guide on his blog:… – gyre May 8 '12 at 15:33
Click the "edit" link under your answer. The issue is that your answer loses 100% of its value if that link ever goes away (which it will). This is why we encourage people to provide relevant content here instead of merely linking elsewhere. So edit your answer and perhaps provide a summary of the content found at the link, and then refer to the link for more in-depth information. – EEAA May 8 '12 at 15:36

I'd do something like this crontab w/

@reboot git pull 

it will execute your "git pull" every time your instance boots.

share|improve this answer
in this sense how do I enter the password. Since I have set the security password – Jeevan Dongre May 11 '12 at 12:14

Your Answer


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.