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
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.
I still wonder why gcp has still not have this feature in the first place like other platforms. Anyways These simple steps did the job for me using Job Scheduler Pub/Sub option.
To stop
gcloud compute instances stop instance-name
.To verify the change you can run the job manually and check.
To start, same procedures as mentioned above the only change you need to have is the payload script ie gcloud compute instances start instance-name
There's also a 3rd party service called VMPower which does exactly this with a calendar interface. It's a lot quicker & flexible than writing a script and it has a decent free tier.
It's 2020, and yes you can! Follow this easy official guide:
https://cloud.google.com/scheduler/docs/start-and-stop-compute-engine-instances-on-a-schedule
..and change these vars: {"zone":"us-west1-b","label":"env=dev"}
I haven't found a way to export/import schedules, but would be nice as there's a lot of manual clicking. You can save a couple clicks by using Copy in Functions to clone the first one.
There is also an option for HTTP triggers by enabling unauthenticated curl messages: https://cloud.google.com/functions/docs/calling/http
EDIT: spoke too soon, it didnt start my instance even though the function test output said "Successfully started instance(s)"