Other Articles

Compute Engine – Enable Instance Deletion Protection

Secure Configuration Checks > GCP

This check ensures that deletion protection is enabled for Compute Engine instances. Deletion protection stops anyone from deleting an instance by mistake.

Check Details

  • Resource: Compute Engine Instance
  • Check: Enable instance deletion protection
  • Risk: An instance that is deleted by mistake can cause an outage. Data on its disks can also be lost.

Remediation via Google Cloud Console

  1. Log in to the Google Cloud Console and navigate to Compute Engine > VM instances. Compute Engine VM instances
  2. Click on the affected VM instance.
  3. Click Edit to modify the instance configuration. Compute Engine VM Edit
  4. Scroll to the Deletion protection section.
  5. Select Enable deletion protection. Compute Engine Deletion Protection
  6. Click Save to apply the changes.

Remediation via Google Cloud CLI

  1. Open the Google Cloud Console and launch Cloud Shell. GCP Cloud Shell
  2. List the instances that have no deletion protection:

    gcloud compute instances list \
    --filter="deletionProtection=false" \
    --format="table(name,zone.basename(),deletionProtection)"
    
  3. Enable deletion protection on the instance:

    gcloud compute instances update <INSTANCE_NAME> \
    --zone=<ZONE> \
    --deletion-protection
    

    Replace <INSTANCE_NAME> with your instance name and <ZONE> with its zone, for example us-central1-a. To delete the instance later, first run the same command with --no-deletion-protection.

  4. Verify the setting:

    gcloud compute instances describe <INSTANCE_NAME> \
    --zone=<ZONE> \
    --format="value(deletionProtection)"
    

    The output must be True.

    Verify Compute Engine deletion protection

Default Value

By default, deletion protection is turned off. It stops deletion only. It does not stop other actions, such as stopping the instance.

Updated on 09 November, 2026