GCP Cloud SDK
Command-line interface for Google Cloud Platform products and services.
Installation
- Visit https://cloud.google.com/sdk/docs/quickstart-mac-os-x
- Download the package for Mac OS X (x86_64)
- Extract the archive
- Move the extracted folder
google-cloud-sdk
to your$HOME
- E.g. the extracted folder is under Downloads
- Open Terminal
mv $HOME/Downloads/google-cloud-sdk $HOME
- Run the install script to add Cloud SDK tools to your path and enable command-completion
cd $HOME ./google-cloud-sdk/install.sh
- Follow the on screen instructions
- When you are asked about
Modify profile to update your $PATH and enable shell command completion? (Y/n)?
- Enter:
n
- To verify, open a tab in Terminal to take effect
- Then type:
gcloud --version
- You should see output like these:
Google Cloud SDK 133.0.0 bq 2.0.24 bq-nix 2.0.24 core 2016.11.01 core-nix 2016.11.01 gcloud gsutil 4.22 gsutil-nix 4.22
Initialize the SDK
- Type this in Terminal:
gcloud init
- Follow the on screen instructions
- Your browser will be launched and ask you to sign in with your Google Account
- After you login with your Google Account, click Allow button to authroize Google Cloud SDK
- Then go back to the Terminal
- Follow the on screen instructions again
Configuration and Credential Files
- The files are generated and stored under:
- ~/.config/gcloud/configurations/config_default
[core]
account = [email protected]
project = hackathon
[compute]
zone = asia-east1-a
region = asia-east1
Multiple configurations
- To create another configuration: (replace
triathlon
by your desired name)gcloud config configurations create triathlon
- A new configuration is created and activated.
- Then:
gcloud init
- But this time, select option 1 Re-initialize this configuration [triathlon] with new settings
- Follow the on screen instructions
- To activate between different configurations
gcloud config configurations activate default
- In order to find out all available configurations:
gcloud config configurations list