Sherali Obidov
Sherali Obidov

Reputation: 139

How to create google cloud instance in available zone?

I have a scheduled builds and deployment of a project on UAT environment using Bamboo. Bamboo executes script to create google cloud instance and run the project inside created instance.

The problem is when I create instance using gcloud compute instances create myproject --image cos-stable-61-9765-79-0 --image-project cos-cloud --zone us-central1-b

I get the following error sometimes:

The zone 'projects/myproject/zones/us-central1-b' does not have enough resources available to fulfill the request. Try a different zone, or try again later.

I know resource availability in regions/zones are not publicly available.

My question is How can I create compute engine instances in resource available region/zones?

Upvotes: 0

Views: 500

Answers (1)

David
David

Reputation: 9721

Like with many API issues, the answer is "retry". First, retry the request in the same zone as the issue might have only lasted a brief time as hinted at in the answer you linked. If a zone remains unavailable, retry with a different zone. There is almost always at least one zone in each region with enough capacity.

Upvotes: 1

Related Questions