I have a requirement in which i have to stop instance group during night hours and then restart in the morning. Is there anyway I can stop instance group for few hours. From console i can change autoscaling to off and set number of instances to 0 but i cant find this option from the API. Please suggest
Asked
Active
Viewed 793 times
2
-
are you using Kubernetes ? – Scott Stensland Aug 10 '16 at 00:05
-
no i m not using Kubernetes – Niket Arora Aug 11 '16 at 07:04
1 Answers
1
You can use:
gcloud compute instance-groups managed stop-autoscaling NAME [--zone ZONE]
and
gcloud compute instance-groups managed set-autoscaling NAME \
--max-num-replicas MAX_NUM_REPLICAS [--zone ZONE]
Note that stop-autoscaling
will not bring down the number of instances to 0 for you, you need set-autoscaling --max-num-replicas
.
The corresponding REST API is InstanceGroupManagers: resize.

Dagang
- 24,586
- 26
- 88
- 133
-
I was looking for java api solution for this. I know gcloud command and console supports this. – Niket Arora Aug 11 '16 at 07:04
-
https://cloud.google.com/compute/docs/reference/latest/instanceGroupManagers/resize – Dagang Aug 11 '16 at 16:49