Learn to use config configurations in gcloud
November 21, 2017
If you are working on multiple projects in GCP you should really leverage the
power of configurations for the gcloud
utility. Context switching and
constant re-typing of config settings is not only boring but also time
consuming and possibly error prone. Better to spend that time on delivering
business value instead. Here is where config configurations come in. They are
easy to setup and super useful.
# create new configuration
$ glcoud config configurations create side-project
# set some configuration settings
$ gcloud config set account hacker@example.com
$ gcloud config set project side-project
$ gcloud config set compute/zone europe-west1-b
$ gcloud config set compute/region europe-west1
# list all configurations
$ gcloud config configurations list
# activate the configuration default configuration
$ gcloud config configurations activate default
$ gcloud config list
# switch back to side-project configuration
$ gcloud config configurations activate side-project
$ gcloud config list
This might not seem like much but paired together with tool like direnv can save you lots of typing in the long run.