views:

490

answers:

2

Can I automatically start and terminate my Amazon instance using Amazon API? Can you please describe how this can be done? I ideally need to start the instance and stop the instance at specified time intervals every day.

+3  A: 

I recommend you take a look at the EC2 Getting Started Guide, which shows you how to do what you need using the EC2 command line tools. You can easily script this into a cron job (on Linux / UNIX) or scheduled job on Windows to call the start and stop commands at a given time.

If you want to do this from your own code, you can use the SOAP or REST APIs; see the Developer Guide for details.

gareth_bowles
+1  A: 

You could look at Ylastic to do this. The alternative seems to be having one machine running that shuts down/starts other instances using a cron job or scheduled task.

Obviously if you only want one instance this is an expensive solution, as one machine has to always be running, and paying ~$80 a month for one machine to run cron jobs isn't cost effective.

Chris S