I run a simple task 3 times a day from my desktop computer. It connects to a certain website at 4pm, 8pm, and 1am, downloads a small amount of data (less then 50mb), and stores it on the harddrive. It's important that this runs everyday, so I am looking into moving this to Google Compute. I know I could just create an instance and leave it on 24/7/365, but that is expensive. Is there a way to have the instance turn on only at 4pm, 8pm, and 1am for 10 minutes each so the data can be downloaded, and then have them turn off after, so I am only charged 30 minutes/day of Google Compute time? Btw, I would be using a Windows Server 2008 image (which is now in limited preview at Google Compute I believe), not a linux image, in case that is relevant.
A stopped instance does not incur charges, but all of the resources that are attached to the instance will still be charged. For example, you are charged for persistent disks and external IP addresses according to the price sheet, even if an instance is stopped.
Suspending an instance differs from stopping an instance in the following ways: Suspended instances preserve the guest OS memory, device state, and application state. Google charges for the storage necessary to save instance memory. You can only suspend an instance for up to 60 days.
There is not a built in scheduler for Compute Engine instances.
You can use App Engine's cron scheduler to make Compute Engine API calls. Here is a sample app which uses cron to list instances and delete ones which have been running for more than 8 hours.
You could do something similar, by making an App Engine url which starts an instance with a startup script which runs your task, copies the data to Cloud Storage and then shuts down the instance as soon as it is complete. Then, create the cron job to hit that URL on your schedule.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With