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

I have a CPU intensive EC2 app, but it only gets accessed for a few hours during the day by a single client. I'd rather not leave a high-cpu instance running constantly - is there a way to lower my usage of the instance?

I'm assuming I need to have one instance (perhaps a small one) constantly running to have something to check for traffic... and then set up something that start/stops the high-cpu instance, and forwards traffic.

What is this called? Where do I find information on configuring this? (Is this something I can do with apache under ubuntu?)

share|improve this question

3 Answers 3

up vote 2 down vote accepted

If your instance has a consistent "uptime", then you can schedule it to run at specific times and just take it down outside of that window.

You can use a home-brew scheduling tool (for example, run something on another instance) or you can use something like Skeddly (www.skeddly.com) to do the heavy lifting for you.

Disclosure: I'm the CEO of Eleven41 Software, the company behind Skeddly.

share|improve this answer
    
Please take care when promoting your product, see the respective FAQ May I promote products or websites I am affiliated with here? for details. –  Steffen Opel May 2 '12 at 16:35

Amazon's Elastic Load Balancing and Auto Scaling might be able to do this as a condition, but what might be more robust is to just schedule uptime for this instance in a time window that makes sense for your customer.

i.e. this instance is up Monday through Friday from 9am until 12pm unless otherwise requested (which could be a ticket they submit to you or you could build a web front-end on another instance that controls start/stop behavior of the instance).

share|improve this answer
1  
That's sounds so much easier than a complicated load balancing scheme - thanks! –  Adam Dec 2 '11 at 11:34

If you have a micro instance running a linux varietal, you can easily use the Amazon Command Line tools to start and stop the instance using crontab

to edit the crontab file, run crontab -e to edit it and add a line like this

(minute) (hour) (day of month) (month) (day of week) (command)

so for example if you wanted to start the server at 5am and stop the server at 10pm every day you would use

0 5 * * * ec2-start-instances [instance id]
0 22 * * * ec2-stop-instances [instance id]

where you put the instance id's you want to start and stop.

You will have to install the ec2 command line tools. You will want to assign an elastic IP to the instances you want to do this, so that no configuration needs to be done when they start up, and whatever application is hitting them, can still get there.

Hope this helps.

share|improve this answer

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.