Reputation: 5037
I'm using a Google Compute Engine
instance for file synchronization. In order to save money I want the instance to be stopped overnight in my time zone. Is there any way to make the instance stop and start at particular times?
I know that I can send the stop and start commands to it using an HTTP
request, but how would I send such a request at the right times if my own computers are not always 'on' at those times?
Upvotes: 2
Views: 4170
Reputation: 2304
If you can send HTTP requests to turn on and turn off an instance, I would advise to use a standalone Google App Script from your Google Drive, that you can configure be executed every morning and every night through script triggers.
From this link :
To manually create an installable trigger through a dialog in the script editor, follow these steps:
- From the script editor, choose Resources > Current project's triggers.
- Click the link that says: No triggers set up. Click here to add one now.
- Under Run, select the name of function you want to trigger.
- Under Events, select either Time-driven or the Google App that the script is bound to (for example, From spreadsheet).
- Select and configure the type of trigger you want to create (for example, an Hour timer that runs Every hour or an On open trigger).
- Optionally, click Notifications to configure how and when you will be contacted by email if your triggered function fails.
- Click Save.
Upvotes: 1
Reputation: 36639
This is not properly supported yet. You need to manually call start/stop commands (using HTTP, gcloud, etc.) from your own scheduler. You could take a look at google app engine, I think it should be possible to implement this kind of functionality there (if you don't have a spare machine to run cron jobs on).
Upvotes: 2