Default Region for Google Cloud CLI

How the default region of google cloud CLI works


After installation of the Google Cloud CLI on WSL with Ubuntu 22.04.3 LTS, the execution of any command was really slow for some reason. It was taking near 1 minute for each execution.

So instead of wasting time debugging, I installed the Google Cloud CLI on Windows PowerShell. Here are the steps I followed.

Install-Module GoogleCloud

Because I was installing module from PSGallery for the first time, which is a Package Manager for the PowerShell. I had to set this Repository as Trusted with this command.

 Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted    

After previous commands you have to run

gcloud init

and follow the onscreen instractions, which will redirect you to a browser page, to connect with your google cloud user to connect cli with your account. From then on you can run gloud commands with PowerShell.

e.g. gcloud redis instances list

The thing that bugged me though was that everytime I had to execute a command lets say gloud redis instaces describe my-redis-instace it was asking me to provide the --region parameter. Hopefully there is a command to set default region for specific google service. Lets say we want to change the default region for the Redis service.

gcloud config set redis/region europe-west3

To get default assigned region

gcloud config get-value redis/region