GCP create config account

March 10th, 2023

create config (only once)

 

#show state before

gcloud config configurations list

 

 

gcloud config configurations create "MY_PROFILE"

 

 

export CLOUDSDK_ACTIVE_CONFIG_NAME="MY_PROFILE"

 

 

gcloud config set core/project "MY_GCP_PROJECT"

 

 

gcloud config set core/account "MY_EMAIL"

 

 

#show state after

gcloud config configurations list

 

use config (every terminal session)

# choose project

export CLOUDSDK_ACTIVE_CONFIG_NAME="MY_PROFILE"

 

 

# login (valid for about an hour)

export GOOGLE_OAUTH_ACCESS_TOKEN="$(gcloud auth print-access-token)"