Cloud termination protection: Prevent accidental resource deletion
Cloud termination protection is a guardrail that blocks deletion requests for selected resources such as critical virtual machines, databases, or projects. Provider controls—including AWS EC2 termination protection, Azure Resource Manager locks, and Google Compute Engine deletion protection—cover different targets and have different exceptions. They do not replace backups or access controls, so scope protection carefully and verify the deletion path.
Cloud termination protection: Prevent accidental resource deletion
Cloud termination protection is a guardrail that blocks deletion requests for selected resources such as critical virtual machines, databases, or projects. Provider controls—including AWS EC2 termination protection, Azure Resource Manager locks, and Google Compute Engine deletion protection—cover different targets and have different exceptions. They do not replace backups or access controls, so scope protection carefully and verify the deletion path.
This guide explains how to reduce accidental or automation-driven deletion using official AWS, Azure, and Google Cloud documentation checked on November 22, 2026. “Termination” here means deleting or releasing a resource, rather than simply stopping a virtual machine. Provider features and scopes are not equivalent; check current documentation for the actual resource type you use.
What does deletion protection prevent, and what does it leave open?
Deletion protection is an extra guard that rejects a specified delete operation. It can reduce damage from a mistaken console action, a script aimed at the wrong target, or some deletion requests made with compromised credentials. It does not prevent service interruption, data changes, replication of corrupted data, account compromise, or mistakes by an administrator who can disable the protection.
These three controls have different jobs:
| Control | Main risk it reduces | What it does not replace |
|---|---|---|
| Deletion protection or resource lock | A particular resource deletion API succeeding | Backups, restore testing, protection from stopping or changing a resource, least privilege |
| IAM/RBAC and change approval | Who can disable protection or delete a resource | Approved credentials running faulty automation |
| Backups, snapshots, and retention | Which data and recovery points remain after deletion or corruption | Blocking the delete request or guaranteeing service recovery time |
For important state, combine a deletion guardrail with backups in a separate account or storage location, a recovery procedure, and change audit records. An enabled protection flag does not prove that data is retained or recovery has been tested.
How do provider controls differ?
| Environment | Representative control | Scope and important limitations |
|---|---|---|
| AWS EC2 | Instance termination protection (DisableApiTermination) | Blocks API termination for that EC2 instance. It is off by default and can be changed while the instance is running or stopped. It does not cover OS-initiated shutdown when that is configured to terminate, scheduled events, Auto Scaling replacement/scale-in behavior, or Spot termination. It cannot be enabled on Spot Instances. |
| AWS RDS | DB instance or cluster deletion protection | Protection must be disabled before deletion. It is separate from the final snapshot and automated-backup retention choices, which must be reviewed as part of the deletion approval. |
| Azure | CanNotDelete or ReadOnly management locks | Can be applied at subscription, resource-group, or individual-resource scope; parent locks are inherited by child resources. CanNotDelete permits reading and changing but blocks deletion; ReadOnly also blocks changes. Broad scope can block intended deployments and cleanup. |
| Google Compute Engine | VM deletionProtection | Blocks delete requests for a specific VM. It does not block stopping, resetting, or shutting down from within the VM. It cannot be set on VMs in a managed instance group or in an instance template. Project shutdown is a separate concern. |
| Google Cloud project | Project lien (deletion restriction) | Protects project deletion and has a different scope from VM-level protection. As shown in the official documentation checked in November 2026, this feature was marked Preview; check its current launch stage and organizational policy before adopting it. |
These names do not represent identical security guarantees. EC2 instance termination, an Azure parent-scope lock, and a Google Cloud project deletion restriction target different APIs and resource lifecycles. A person may still be able to disable protection, and a provider may carry out certain managed events.
Which resources should be protected, and at what scope?
Start with stateful and foundational resources whose loss would cause substantial service interruption or recovery cost. Common candidates include databases, production VMs, network hubs, key-management resources, and projects needed for recovery. Protecting every ephemeral VM can interfere with autoscaling, replacement, deployment, and cleanup.
For each resource, record:
Unique ID, resource type, account/project/subscription, region, and owning team
Exact protection feature and scope, current value, and location of its infrastructure-as-code declaration
Roles allowed to disable protection, approvers, and emergency change procedure
Data loss, service impact, and restore path if the resource is actually deleted
Whether automation, autoscaling, or infrastructure code conflicts with the guardrail
For example, EC2 termination protection may suit a critical API VM, but if an Auto Scaling group must replace unhealthy instances, enabling only this control will not deliver the intended behavior. Review group policy, lifecycle, backups, and capacity design as well. In Azure, a lock on one database may be appropriate, while a lock on its entire resource group may prevent deployment automation from updating or cleaning up related resources.
Apply and verify protection safely
**Identify the deletion target.** Check the account/project, region, resource ID, tags, and dependent services rather than relying on the name alone. Distinguish similarly named development and production resources.
**Check recovery needs and automation behavior.** Review point-in-time recovery, snapshot retention, disk behavior on termination, and replacement behavior in autoscaling and deployment tools. Deletion protection is not a recovery mechanism.
**Apply protection at the narrowest supported scope.** Do not lock an entire project or subscription when a resource-level feature is sufficient. In Azure, inherited locks can block deletion and deployment operations on child resources.
**Verify the setting with read-only inspection.** Check EC2 `DisableApiTermination` or RDS deletion-protection state; list Azure locks on the target and its parent scopes; or inspect the Google VM's `deletionProtection` value. For a Google project lien, also check the feature's current launch stage and organizational policy.
**Test denial on a nonproduction resource.** Use an approved test resource to confirm a delete request is rejected and produces the expected error and audit record. Do not test by deleting a production resource. Do not execute a delete just because a console or command shows it as available; first verify the real target.
**Document emergency disable and re-enable.** Define who can disable protection and what evidence is required, including approval, backup checks, maintenance window, and re-protection verification. Avoid granting broad disable rights to ordinary deployment identities; retain change logs and alerts.
**Reconcile the policy and inventory regularly.** New production resources may be missing protection, while retired resources can become stuck behind locks. Check for differences between infrastructure-as-code declarations and actual cloud settings.
When protection works as intended, the delete request is rejected, while permitted reads or changes continue according to the product's policy. If you receive a denial error, first check the target ID, inherited lock, project/group administrator, whether a service owns the resource, and whether automation is intentionally trying to replace it. Do not disable protection blindly.
What if a resource really must be deleted?
For a planned retirement, record the exact resource ID, affected services, data-retention method, final backup or snapshot check, approver, restore deadline and cost, and the order for handling dependent resources in the change request. If protection must be disabled, keep the window as short as possible and recheck the target and backups immediately before deletion. Afterward, review backups and retention policies, attached IPs/disks/snapshots/replicas, and billing items; restore protection on any remaining resource in that scope.
AWS RDS documentation asks operators to choose whether to create a final snapshot and retain automated backups before deletion. Retained backups and manual snapshots can continue to incur charges. If no final snapshot is created and automated backups are not retained, recovery options are reduced. Details differ by service, so consult the current product-specific procedure before deleting.
Official documentation
[Change Amazon EC2 instance termination protection](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_ChangingDisableAPITermination.html)
[Delete an Amazon RDS DB instance: protection and backup considerations](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_DeleteInstance.html)
[Protect Azure resources with locks](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/lock-resources)
[Prevent accidental deletion of a Google Compute Engine VM](https://docs.cloud.google.com/compute/docs/instances/preventing-accidental-vm-deletion)
[Protect Google Cloud projects with liens](https://docs.cloud.google.com/resource-manager/docs/project-liens)
Based on official documentation checked on November 22, 2026. Recheck the feature stage, supported targets, and exceptions before applying a control. This article does not report an inspection of a user's account or a test of deletion protection.