Is it possible to let to GCP choose availability zone?

  During a new VM launch,  GCP console allows to choose 'region' and 'zone', that translates to 'zone' in GCP CLI. For instance, '--zone=us-central1-a'.
  Occasionally, my 'gcloud compute instances create' fails with the following error 'code: ZONE_RESOURCE_POOL_EXHAUSTED_WITH_DETAILS'.  I.e. choose zone doesn't have enough capacity for my instance type. It will be nice to have the ability to ask GCP to launch a new VM in a certain region, in any availability zone (as we have in another cloud provider). But I couldn't find such feature....

Solved Solved
1 4 412
1 ACCEPTED SOLUTION

Hi @vitaly_il ,

A workaround would be to create a managed instance group (MIG) with a max size of 1 and with the distribution shape [1] set to "ANY". The VM will be created in any zone that has the resources required for the VM.

[1] https://cloud.google.com/compute/docs/instance-groups/regional-mig-distribution-shape#how_any_works

View solution in original post

4 REPLIES 4

Hello @vitaly_il,

Welcome to Google Cloud Community!

Upon further checking, this feature is not yet supported. You may submit your query as a Feature Request in the Public Issue Tracker.

However, for feature requests there is no guarantee of any time frame for updates or that the requested feature will be implemented.

Thank you!

Hi @vitaly_il ,

A workaround would be to create a managed instance group (MIG) with a max size of 1 and with the distribution shape [1] set to "ANY". The VM will be created in any zone that has the resources required for the VM.

[1] https://cloud.google.com/compute/docs/instance-groups/regional-mig-distribution-shape#how_any_works

Many thanks, didn't know about MIG!

You're welcome, @vitaly_il !