How can I automatically start a program on Amazon's EC2 Windows 2008 web servers?

For example, if I wanted to test the "Digg effect" on a web page of mine, how could I open 100 windows 2008 servers at once, each loading one (or two?) instances of the firefox web browser?

I have placed a sample batch file in the windows startup folder that echos the time it was called, but it is only started when I actually login remotely via the remote desktop protocol.

I don't want to have to login to 100 servers to get my software to run :P What can I do?

I am using this Windows 2008 Datacenter, Amazon-supplied AMI specifically: ami-a2698bcb


How can I automatically start a program on Amazon's EC2 Windows 2008 web servers?

Just run it as a service. Follow this tutorial:



| improve this answer | |
  • Marius, you da man!! Is there any super simple way to accomplish this on linux as well, do you know??? Their virtual linux boxes are almost half the price! – darkAsPitch Feb 10 '10 at 19:40

On Linux use wget instead of firefox and write a small script like this:

# Script name: myscript.sh
case $1 in
   for ((i=0; i<=100; i++))
   wget -q -O - http://www.yoursite.com
   sleep 1

make it executable, copy it into the /etc/init.d directory, make a symlink to it in your default runlevel init directory (/etc/rc2.d for Debian &co, /etc/rc5.d for other distros) and name the link S99myscript.

Now everytime your instance boot, it will send 100 http requests to your site (1 per second).


| improve this answer | |

I use WinServ (http://www.sw4me.com/wiki/Winserv) instead of the resource kit, since there could be issues with the 2k3 resource kit on 2k8. Plus WinServ will let you use a batch file for your service, etc.. And its free.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.