Skip to content

Instantly share code, notes, and snippets.

@Ropes
Last active July 20, 2017 18:25
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 Ropes/15073ce26177bd3a9f14ef8415501f02 to your computer and use it in GitHub Desktop.
Save Ropes/15073ce26177bd3a9f14ef8415501f02 to your computer and use it in GitHub Desktop.
Summations of Standard GCP VM CPUs

Sum the number of cores of running VMs in GKE

gcil | grep standard | grep RUNNING | awk '{print $3}' | cut -d'-' -f3 | paste -s -d+ | bc

Add tags to all VMs of an instance Group

gcloud compute instance-groups list-instances <GKE INSTANCE GROUP NAME> --format=json | jq .[].instance | cut -c93- | tr -d "\"" | xargs -d " " gcloud compute instances add-tags --tags=$TAG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment