GCP Accounts and Projects

GCP Accounts and Projects #

Oftentimes, you’ll have to switch between GCP accounts or projects.

Authentication #

gcloud auth login

^ this will open up a browser prompt

To authenticate without a browser:

gcloud auth login --no-browser

Accounts #

See accounts #

To see accounts with creds stored locally:

gcloud auth list

Switch accounts #

gcloud config set account <account name>

Can also switch accounts by swapping configs:

gcloud config configurations activate <CONFIG>

Projects #

See projects #

gcloud projects list

Switch projects #

gcloud config set project `<project name or project id>`