Background and Goal
I have a Debian/Linux VM
on GCP
which I manually start every morning and after it runs, it shuts down by itself using a Linux command. I want to automate the start of the VM by using the Cloud Scheduler
. The question asked in GCP auto shutdown and startup using Google Cloud Schedulers has several answers and I am interested in pursuing the answer (https://stackoverflow.com/a/65062924/10322004) proposed by @nikelone
because it seems to be simple and also it has been endorsed by @Damien
and @RayFoss
as being easy. I am a neophyte in these matters and I could not comprehend their replies fully. So this post was created to elicit more clear answers for a person like me.
What I have tried
I have gone to https://cloud.google.com/compute/docs/reference/rest/v1/instances/start (call this page A
) and tried the API
and was able to successfully start my already stopped VM
when I clicked on the execute button. I presume that this means that my entries were fine and can be used in conjunction with appropriate software like Cloud Scheduler
to perform the start function on a predefined schedule. But the problem is that I do not know or understand how to proceed from here. I give below my questions.
My Questions
On
page A
, the last three paragraphs are titled Authorization Scopes, IAM permissions, and Examples, and none of them say anything specific about what the user should do. Is it correct to assume that they have nothing to do with theCloud Scheduler
, but related to other methods to achieve the same goal? If this is not correct then my next question is what should I be doing to follow the statements in these three paragraphs?Assuming that the answer to question 1 is "yes", meaning I can now start scheduling with the
Cloud Scheduler
, I next looked at thequickstart
forCloud Scheduler
at https://cloud.google.com/scheduler/docs/quickstart (call this page B
). The list of items to do is quite large including installing Cloud SDK, running a quite a few commands on the console, enabling some features, set up Pub/Sub, create a job, run the job and verify the results in Pub/Sub. This looks like a daunting set of tasks and I could not understand why it is necessary to jump through the hoops to use something that has already been achieved with just a few keystrokes earlier. So are these steps all necessary? Or is there a way to use the Cloud Scheduler directly without going through so many intermediate steps?Now assume that the answer to question 2 is that I have to perform all steps stated on
page B
. If I run into some problem while accomplishing the tasks outlined on page B, myVM
may get messed up irretrievably. Is there a way in which the Cloud Platform or its components can be used to reset myVM
to its current state as of today, which is working fine? I really do not want to end up with something worse than what I have now.