Hi,
I am a newbie in GCP and just created a debian vm and I am able to use python.
I want that the VM will be started and stopped at special times.
When I try to read documentation I got lost.
I first tried to create a function:
import googleapiclient.discovery
import os
Thanks for your reply.
I have seen this, but I don’t understand how to create a resource policy.
When I search for it I get not a recognizable topic.
Going through some links I feel like standing in a forest.
What to do?
Hi DamianS,
documentation says:
“Scheduling a VM instance to start and stop
Instance schedules let you start and stop virtual machine (VM) instances automatically. To use instance schedules, create a resource policy detailing the start and stop behavior, and then attach the policy to one or more VM instances.”
I don’t know more.
Ahhh. Okay So basically, try to either use cloud command or UI for policy creation. UI should be easier to handle. If you will have any issues, let us know. We always happy to help
Both options have field / parameter description so you should be able to handle it.
Basically you need :
PS: Most probably you will get information ,that service account with name like mine (service-238313586149@compute-system.iam.gserviceaccount.com)) needs specific permissions to stop VM. Simply before you do something, go to IAM → Tick small check box " Include Google-provided role grants" at the top right corner → Find your Service Account → Click on pencil icon next to this account and grant Compute Instance Admin V1 role. Once done, follow policy creation.
And now my instance is not available in the zone.
Is it now locked or what happend?
Where can I see the reason?
edit: in the logs I see ZONE_RESOURCE_POOL_EXHAUSTED
A e2-micro VM instance is currently unavailable in the europe-west3-b zone.
but why? it was available as I created it.
Sometimes due to internal error or high demand, some of regions are overutilized. As a results, when you starting or creating resources, you can get ZONE_RESOURCE_POOL_EXHAUSTED. Try different zone than europe-west3-b.