Introduced in CloudStack 4.20, the Delete Protection feature mitigates the risk of accidental deletion for Instances and Volumes. This feature addresses a common challenge in cloud environments, where users may unintentionally delete critical resources, leading to potential data loss, service disruptions, and costly recovery efforts.
Delete Protection works by allowing users to enable a safeguard on selected Instances and Volumes, preventing them from being deleted or expunged within the CloudStack UI or via API calls unless the protection is manually disabled. With this safeguard in place, users can manage bulk deletions and other actions with greater confidence, knowing that crucial resources won’t be inadvertently lost.
This feature is especially valuable for teams and organizations managing complex infrastructures where Instances and Volumes may be frequently provisioned and de-provisioned. By enabling delete protection on key resources, CloudStack users can improve data reliability, minimize unplanned downtime, and avoid the operational costs associated with accidental deletions and unexpected recovery.
Understanding the Risks of Accidental Deletion
In cloud environments, where resources are frequently created, modified, and deleted, even experienced users may accidentally delete Instances or Volumes. These actions, especially during bulk operations, can have significant consequences, including:
- Data Loss: Instances and Volumes hold essential data and configurations. Deletion can cause immediate loss, disrupt operations, and require recovery from backups, if available.
- Service Downtime: Removing an active Instance can interrupt services, affecting users and causing business disruption depending on service importance.
- Configuration Loss: Tailored configurations may be hard to recreate if deleted, especially without proper backups, leading to delays in service restoration.
- Operational Costs: Recovery often requires time, resources, and additional expenses, including unexpected charges.
Note: Delete Protection applies only when deleting resources via CloudStack’s UI or API. It does not prevent deletion through external means, such as hypervisors or storage devices. For example, Instances within an AutoScale Instance Group may still be terminated if scaling policies require it, even with Delete Protection enabled.
Enabling Delete Protection for an Instance
- Using CloudStack UI:
- Navigate to the Instances page.
- Select the Instance you with protect.
- Click on the Edit Instance button in the top-right corner.
- In the Edit Instance form, toggle the Delete Protection switch to enable it.
2. Using the CLI:
- To enable Delete Protection via cmk, use the following command:
cmk update virtualmachine id=<ID of the Instance> deleteprotection=true
Once enabled, attempts to delete this Volume will require Delete Protection to be disabled first.
Disabling Delete Protection for Instances
If you need to delete a protected Instance, follow the same steps as above, but toggle the Delete Protection switch to disabled in the UI. Alternatively, you can use the same CLI command, setting deleteprotection=false.
This will remove Delete Protection, allowing the Instance to be deleted as usual.
Enabling Delete Protection for Volumes
- Using CloudStack UI:
- Navigate to the Volumes page.
- Select the Volume you want to protect.
- Click on the Edit Volume button in the top-right corner.
- In the Edit Volume form, toggle the Delete Protection switch to enable it.
2. Using CLI:
- To enable Delete Protection for a Volume, use the following command:
cmk update volume id=<ID of the Volume> deleteprotection=true
Once enabled, attempts to delete this Volume will require Delete Protection to be disabled first.
Disabling Delete Protection for Volumes
If you need to delete a protected Volume, follow the same steps as above but toggle the Delete Protection switch to disabled in the UI. Alternatively, you can use the same CLI command, setting deleteprotection=false.
This will remove Delete Protection, allowing the Volume to be deleted as usual.
Conclusion
The Delete Protection feature in CloudStack 4.20 provides an added layer of security for critical Instances and Volumes, reducing the chances of accidental deletion through intentional safeguards. By requiring delete protection to be manually disabled before a resource can be removed, this feature supports operational continuity and protects against unintentional data loss.
This feature is particularly valuable for managing resources in complex, high-activity environments where accidental deletions could impact data integrity and service reliability. Though it’s essential to note its scope within CloudStack, Delete Protection offers a straightforward solution for preserving key resources and maintaining stability in cloud operations.
![Vishesh Jindal](https://www.shapeblue.com/wp-content/uploads/2024/01/Visesh-150x150.jpeg)
Vishesh Jindal is a software engineer at ShapeBlue. He has experience in developing and managing cloud infrastructure. He has a particular interest in databases and has worked extensively on them.
When Vishesh is not working, he enjoys watching anime, playing DOTA, or working on an open-source project.