Reputation: 4230
I have a situation to delete lot of VMs which was created in my GCP Project. But I need to delete all those VMs before I enable the billing.
Is this possible?
I tried with Cloud Shell, but No luck as the VM are Delete protection enabled.
Upvotes: 0
Views: 2108
Reputation: 1269
You can use the Cloud Console, Cloud Shell or GCP API to disable the Delete Protection first.
For Cloud Console, just go to Compute Engine > VM Instance > Click the instance to be edited > Click Edit > Uncheck "Enable Deletion Protection".
But for multiple VM's it is advisable to use the cloud shell instead. See the template below:
gcloud compute instances update [INSTANCE_NAME]
[--deletion-protection | --no-deletion-protection]
For example:
gcloud compute instances update vm-instance1 --no-deletion-protection
For more information about this topic, you can check this link. Toggling deletion protection
Upvotes: 3