Niket Arora
Niket Arora

Reputation: 71

Instance Group : remove autoscaling and set number of instances to 0

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

Upvotes: 2

Views: 1132

Answers (1)

Dagang Wei
Dagang Wei

Reputation: 26458

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.

Upvotes: 1

Related Questions