There is a great tutorial in the Google Cloud Site. The address is
https://cloud.google.com/scheduler/docs/start-and-stop-compute-engine-instances-on-a-schedule
Extra note to help with the tutorial:
When you get to the part where you are setting up the Functions. You may need to do base64 conversion if you are using the free tier option, the tutorial is for the west zone and free tier is only available in the central zone. Also once you have the string converted you need to remove the OK from the end and add o=
There are my notes of the process:
sample string:
{"zone":"us-west1-b", "label":"env=dev"}
sample as base 64
{"data":"eyJ6b25lIjoidXMtd2VzdDEtYiIsICJsYWJlbCI6ImVudj1kZXYifQo="}
converter url:
https://www.base64encode.net/
results using sample string above
eyJ6b25lIjoidXMtd2VzdDEtYiIsICJsYWJlbCI6ImVudj1kZXYifQ0K
or
eyJ6b25lIjoidXMtd2VzdDEtYiIsICJsYWJlbCI6ImVudj1kZXYifQ==
The results are the same as the sample except the different in the last to characters.
desired input string:
{"zone":"us-central1-a", "label":"env=dev"}
output base 64 string
eyJ6b25lIjoidXMtY2VudHJhbDEtYSIsICJsYWJlbCI6ImVudj1kZXYifQ0K
Add the JSON formatting and adjust the last to characters:
{"data":"eyJ6b25lIjoidXMtY2VudHJhbDEtYSIsICJsYWJlbCI6ImVudj1kZXYifQo="}
Hope it helps you get the base64 string conversion bit.
You've got to take a leap of faith.
There are two kinds of Free tiers:
The Google Cloud Platform Free Tier is your opportunity to learn and use GCP for free. It has two parts: a 12-month, $300 credit free trial and Always Free. The 12-month, $300 free trial allows you to use any GCP product. Always Free allows you to try participating products for free up to their non-expiring usage limits, making it easy for you to test and develop with these products.
Regarding the "Always Free" part, until the very end it's going to show you a price, but if you keep below the Free Tier specs you won't be billed.
Just to be sure I contacted their suport and was answered (bold added by me):
I understand that you want to use a free f1-micro instance type but
bothered to use it due to showing estimated monthly price of $4.28.
As you are eligible for ¨Always Free¨, 1 f1-micro is free of charges
per month as you can see on this link [1]. In case you get charges
using 1 f1-micro please contact our billing support using this link
[2]
Best Answer
This is possible using the gcloud command line tool, though its in a
beta
at the moment, it still works perfectly and got me out of a sticky situationgcloud beta app repair --project <your project id>
This will restore all the default service accounts. docs here They were quite hard for me to find, so I hope this answer helps others.