My Google Cloud Cheat Sheet

Here are few commands that I find myself using a lot when I am working with gcloud cli, and Google Cloud

gcloud filters

When I have lots of instances and want to get a clean list which matches a criteria, I combine filters and format to get fine grained info

# example usage of filters and format
gcloud compute instances list --filter="name:($hostname)" --format="[no-heading](name, networkInterfaces[].networkIP, zone, status)"
# output
postgres-staging-1  <IP>  us-west3-b  RUNNING
postgres-staging-3  <IP>  us-west3-a  TERMINATED
postgres-staging-4  <IP>  us-west3-c  TERMINATED

Get GKE cluster list

gcloud container clusters list

Get credentials for a gke cluster

gcloud container clusters get-credentials <cluster name>

👋 Like what you have read, Subscribe to get updates 📩

Continue Reading