I would like to ask, what automatic tools are there to start Amazon EC2 instance at 08:00AM and stop it on 16:00 (And where to run it from?)
-
You may find more info about how to use the Amazon EC2 Command Line Tools for scheduling instances in [this thread](http://stackoverflow.com/questions/2413029/auto-shutdown-and-start-amazon-ec2-instance). – danoo Aug 05 '11 at 15:26
-
FYI, for anyone looking for answers here... a lot of the services mentioned below are now dead links. We're currently using https://awssomesauce.com with much success. – jdmcnair Jun 24 '15 at 20:07
-
For a lightweight solution, I'd suggest to [Schedule EC2 Start / Stop using AWS Lambda](http://stackoverflow.com/a/38371889/4058484), it costs less than $0.0004 USD/month. – eQ19 Jul 16 '16 at 04:49
-
However, it seems more expensive if you consider developer labor costs. I use [Cloud Scheduler](https://scheduler.gncloud.io/) service, and it costs about $ 10 a month. – Sang Song Nov 11 '17 at 03:07
6 Answers
The company I work for had customers regularly asking about this so we've written a freeware EC2 scheduling app available here:
http://blog.simple-help.com/2012/03/free-ec2-scheduler/
It works on Windows and Mac, lets you create multiple daily/weekly/monthly schedules and lets you use matching filters to include large numbers of instances easily or includes ones that you add in the future.

- 1,602
- 12
- 12
Well to shut the servers down, you could just schedule a task on the server(s) itself to tell it to shutdown at 16:00.
However if you use the Amazon EC2 Command Line Tools you can run commands from your workstation to start and stop instances:
In order to set up the Command Line Tools on your workstation for Mac/Linux the following guides may be useful:
- http://www.robertsosinski.com/2008/01/26/starting-amazon-ec2-with-mac-os-x/
- http://cloud-computing.learningtree.com/2010/09/28/using-the-amazon-ec2-command-line-tools-and-api/
You could even configure these commands to run when you boot your workstation, or schedule them on your workstation.

- 5,498
- 4
- 49
- 72
Amazon doesn't offer any functionality to support this.
The preferred solution (at present) is to run a cron task from an existing server.

- 3,019
- 2
- 18
- 15
You can do this by running a job on another instance that is running 24/7 or you can use a 3rd party service such as Ylastic or Rocket Peak.
If you want to set it up yourself, for example, in C# the code to stop a server is quite straightforward:
public void stopInstance(string instance_id, string AWSRegion) { RegionEndpoint myAWSRegion = RegionEndpoint.GetBySystemName(AWSRegion); AmazonEC2 ec2 = AWSClientFactory.CreateAmazonEC2Client(AWSAccessKey, AWSSecretKey, myAWSRegion); ec2.StopInstances(new StopInstancesRequest().WithInstanceId(instance_id)); }

- 136
- 4
I'm not sure that there is, but I believe that a lot of people have interest in such a product. I've actually got a product that does the opposite of what you need -- it stops a machine after a predetermined amount of time ;-). My guess is that you're looking to save EC2 $$$ by running your instances only during daytime hours. If that's the case then I believe my existing product could easily be twisted to meet your needs.

- 398,270
- 210
- 566
- 880

- 3,017
- 3
- 24
- 29