Ensure that your production Google Compute Engine instances have Deletion Protection feature enabled in order to protect them from being accidentally deleted.
Production and mission-critical Google Cloud virtual machine (VM) instances often need to stay running indefinitely, therefore you may need a way to protect these instances from being terminated. With Deletion Protection safety feature enabled, you have the guarantee that your VM instances cannot be accidentally deleted and make sure that your production environment remains safe.
Audit
To determine if your virtual machine (VM) instances are protected from accidental deletion, perform the following actions:
Remediation / Resolution
To enable Deletion Protection safety feature for your production and business-critical Google Cloud VM instances, perform the following actions:
Note: You can enable deletion protection for an existing VM instance, regardless of the instance current status. Specifically, stopping the instance before enabling the feature is not required.References
- Google Cloud Platform (GCP) Documentation
- Virtual machine instances
- Deleting an Instance
- Preventing Accidental VM Deletion
- GCP Command Line Interface (CLI) Documentation
- gcloud projects list
- gcloud compute instances list
- gcloud compute instances describe
- gcloud compute instances update