I am running a private website using a turnkey Joomla AMI. It is mostly used during the daytime business hours. No need for the instance to run 24/7. What is the easiest way to setup an automatic start and stop? I have looked at the "auto scaling" features within the EC2 docs. It looks pretty complicated with lots of code entry (which I am not familiar with). Is there any "easy" way to establish a schedule?

Thank you.

Alon Swartz's picture

There isn't an out of the box solution for this, but you could probably roll your own stop/start script using the Hubs API and cron - take a look at HubTools.

Thanks for your reply, Alon. I am pretty new to the Turnkey Hub and cloud hosting in general (hence why I signed up for the Turnkey solution :)).

Would the cron script originate from the Turnkey Hub that I use to manage my servers, or would it reside on the EC2 instance itself? I am thinking that once the instance is stopped, it could not bring itself back alive again by a cron job. So would the I use the Web Shell in the Turnkey hub to create the cron job?



Alon Swartz's picture

Sorry I wasn't clear about this before. You need to put the script (which will be executed by a cron job) on a computer/server that is preferably always online.

Let me explain:

  • The script you would need to write can use HubTools or the Hub API directly to stop and start an instance, something like: myscript.py --instanceid=i-123456 --action=<stop|start>
  • The script would then be executed by 2 different cron jobs, one in the morning and one and night, which would pass a different --action (start in the morning, stop at night)
  • Now, the cronjobs and the script need to be on a computer with an internet connection, that is online when the cronjobs should run. This might be your home/office computer, or maybe even a micro instance on EC2 (which, if your in the AWS free tier would be free for 1 years worth of hours)

Seeing as you're new to this stuff, it might be a nice weekend project, or might not be worth the effort, as the money you would save wouldn't be that much anyway.

Hope the above helps...


Hi Alon,

I think that will work. I can use a micro instance to control my small instance. Thanks for the explanation!

Hendrick's picture

Being a newbie myself, I am also asking myself why not make it easy to turn on / turn off an instance just like what www.bitnami.org appliance have. You just simply choose the time, date etc for an instance to turn on and off.

It would be great if we could use the Hub to turn on / off an instance.

Add new comment