Reputation: 12663
As part of a startup script I use gcloud
to create a disk from a snapshot:
gcloud compute disks create ...
and then attach it to the current instance
gcloud compute instances attach-disk `hostname` ...
I'd like to have this disk be deleted when the instance is deleted but I don't see the equivalent of "the "Delete Disk" Deletion rule see in the web console when editing an instance. How can I do this with a gcloud
command?
Upvotes: 0
Views: 368
Reputation: 12663
Found it right there in the docs: https://cloud.google.com/sdk/gcloud/reference/compute/instances/set-disk-auto-delete
Example:
gcloud compute instances set-disk-auto-delete `hostname` --disk=DISKNAME --zone=MY-ZONE
Upvotes: 2