This is a draft cheat sheet. It is a work in progress and is not finished yet.
GCP Basic
Check version & settings |
gcloud version, gcloud info, gcloud components list |
Init profile |
gcloud init |
List all zones |
gcloud compute zones list |
|
|
Buckets
List all buckets and files |
gsutil ls, gsutil ls -lh gs://<bucket-name> |
Download file |
gsutil cp gs://<bucket-name>/<dir-path>/package-1.1.tgz . |
Upload file |
gsutil cp <filename> gs://<bucket-name>/<directory>/ |
Cat file |
gsutil cat gs://<bucket-name>/<filepath>/ |
Delete file |
gsutil rm gs://<bucket-name>/<filepath> |
Move file |
gsutil mv <src-filepath> gs://<bucket-name>/<directory>/<dest-filepath> |
Copy Folder |
gsutil cp -r ./conf gs://<bucket-name>/ |
Show disk usage |
gsutil du -h gs://<bucket-name/<directory> |
Create bucket |
gsutil mb gs://<bucket-name> |
Commands to interact with GCP storage bcukets and objects
Bucket Security
Make all files readable |
gsutil -m acl set -R -a public-read gs://<bucket-name>/ |
Config auth |
gsutil config -a |
Grant bucket access |
gsutil iam ch user:test@gmail.com:objectCreator,objectViewer gs://<bucket-name>/ |
Remove bucket access |
gsutil iam ch -d user:test@gmail.com:objectCreator,objectViewer gs://<bucket-name>/ |
|
|
GCP Project
List projects |
gcloud config list project |
Show project info |
gcloud compute project-info describe |
Switch project |
gcloud config set project <project-id> |
Commands for interacting with GCP projects
GKE
Display list of credentailed accounts |
gcloud auth list |
Set active account |
gcloud config set account <ACCOUNT> |
Set kubectl context |
gcloud container clusters get-credentials <cluster-name> |
Change region |
gcloud config set compute/region us-west |
Change zone |
gcloud config set compute/zone us-west1-b |
List all container clusters |
gcloud container clusters list |
Commands for interacting with Google Kubernetes Engine
|