Skip to content

Instantly share code, notes, and snippets.

@veysiertekin
Last active May 23, 2021 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save veysiertekin/149d826d921fb1e91d49dd50ca1432e4 to your computer and use it in GitHub Desktop.
Save veysiertekin/149d826d921fb1e91d49dd50ca1432e4 to your computer and use it in GitHub Desktop.
GCP google gloud gcloud

Installation

Install with Homebrew

brew install --cask google-cloud-sdk

Set up terminal support

Add following command to .zshrc file

source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc"
source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc"

Init

Bind google account with computer. This command will open a browser window and will prompt you to login & approve authorization.

gcloud init

Tutorial

https://cloud.google.com/pubsub/docs/building-pubsub-messaging-system

Warmup

gcloud pubsub topics list
gcloud pubsub subscriptions list

Set Up Python Environment

python3 -m venv ~/pyenv/pyenv-qs
source ~/pyenv/pyenv-qs/bin/activate

# deactivation
deactivate

Install Pub/Sub after environment activation

pip install --upgrade google-cloud-pubsub
export GOOGLE_APPLICATION_CREDENTIALS=~/Downloads/gcp-key.json
export PROJECT=$(gcloud config get-value project)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment