Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How would I be able to automatically schedule an amazon EC2 Micro instance to stop? I haven't created an amazon account yet; I just want to know if I would be able to do it.

For example, have the instance turn off from 1AM to 7AM and then back on again.

I'm planning to host a minecraft server on it, I'm not sure if micro might be too small. I am also concerned how much the upload/download rates are

share|improve this question
add comment

migrated from superuser.com Aug 15 '11 at 21:11

This question came from our site for computer enthusiasts and power users.

4 Answers

You can cron a shutdown (/sbin/shutdown -h now) on the instance itself just as you would any other server.

The issue you will have is starting it back up at 1am. You will need to start the instance via another server using the command line tools: ec2start *instance_id* or the web console. https://console.aws.amazon.com/ec2/home?region=us-east-1#s=Instances

share|improve this answer
add comment

The upload/download rates do vary by what availability zone you're hosting in. For US/EU, it's $0.12/GB until you get to 10TB of transfer (Asia is more expensive). I have no idea how much transfer a Minecraft server will incur, but the price gets a bit cheaper once you go over that level.

The pricing is all on one page:

http://aws.amazon.com/ec2/pricing/

share|improve this answer
add comment

To accomplish what you're wanting you're wanting you'd most likely need to have some external host that you could script the micro EC2 instance initialization at the given start time and then you could configure the instance itself to run a cron job to shutdown.

Micro EC2 instance are EBS-backed instances which means that the image persists after shutdown unlike larger instance-store instances where they start fresh each restart from the AMI. This allows you to setup and configure everything as you want it when operating, including cron job execution. This does mean you'll be paying for EBS volume storage for your instance, but those costs are generally negligible.

The problem with using auto-scaling as some have mentioned is that auto-scaling is meant as a means to scale up and then back down when certain metrics are hit. Auto-scaling is not meant to start up and shutdown instances at specific times. In order to have your instance start up at as you suggest 1am you would need to either fire it off yourself from the console, API CLI or script. I write my scripts to start instances in Python and make use of the Boto module. A script to check to see if the instance is already running and if not start it would be fairly trivial to write and could be executed via cron from an external host that's got internet connectivity. The shutdown would then be handled by the cron job executed on the micro instance itself.

As for the question regarding bandwidth. Having been running about a dozen instances providing web services with rather large userbases I've found that the bandwidth costs are actually quite negligible when compared with the hourly run time of the instances. Now I'm saying that given I run our EC2 instances 24/7 not just a few hours a day. You can use the AWS Simple Monthly Calculator to give yourself a general idea of the costs. You'll need to estimate what you think the numbers will be if you don't already have data to go by. I used this calculator as well as my own spreadsheet formulas to get an idea before launching and then checked them again after a couple months of routine usage and found them to be fairly accurate but dependent on the accuracy of the data.

share|improve this answer
add comment

Your Answer

 
discard

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.