Can Google Compute instances be started and stopped on a schedule?

前端 未结 4 513
忘掉有多难
忘掉有多难 2021-02-06 06:17

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

4条回答
  •  南旧
    南旧 (楼主)
    2021-02-06 06:57

    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

    • Create a new JobScheduler.
    • Fill in the required details
    • Choose frequency which suits your requirement.
    • Choose the target to Pub/Sub.
    • Choose the topic name (Create a new topic if not created ).
    • In the payload section use this stop script 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

提交回复
热议问题