Skip to content

Instantly share code, notes, and snippets.

$ python code-samples/gcloud-python/delete_unattached_unused_disks_gcloud.py
Disk kube-master is attached to instance kube-master
Disk orphan-disk-2 is not attached to any instance and is not labeled for delete protection
Executing command "gcloud compute disks delete orphan-disk-2 --zone europe-west1-b --project sj-test-070218"
Disk orphan-disk-3 is not attached to any instance and is labeled for delete protection
$ python code-samples/gcloud-python/start_stop_instances_labels_gcloud.py
Executing command "gcloud compute instances stop kube-master --zone us-central1-c --project sj-test-070418"
Stopping instance(s) kube-master...done.
Updated [https://www.googleapis.com/compute/v1/projects/sj-test-070418/zones/us-central1-c/instances/kube-master].
Executing command "gcloud compute instances stop db-server-1 --zone us-central1-c --project sj-test-070218"
Stopping instance(s) db-server-1...done.
Updated [https://www.googleapis.com/compute/v1/projects/sj-test-070218/zones/us-central1-c/instances/db-server-1].