Wednesday, September 28, 2022

[FIXED] How to create google cloud instance in available zone?

Issue

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?


Solution

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.



Answered By - David
Answer Checked By - Cary Denson (PHPFixing Admin)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.