Deletion protection is a feature of Resource Orchestration Service (ROS) that prevents a stack from being accidentally deleted. When you enable deletion protection for a stack, any attempt to delete the stack fails, and its state remains unchanged.
Prerequisites
Ensure you have permission to set deletion protection (ros:SetDeletionProtection). For more information, see Use RAM to control resource access.
Background information
You cannot enable deletion protection for a stack that is being deleted. A nested stack inherits its deletion protection property from its parent stack. This property is always consistent with the parent's and cannot be modified directly. To enable deletion protection for a nested stack, you must perform the operation on its parent stack.
Enable deletion protection during stack creation
Log on to the ROS console.
In the left-side navigation pane, click Stacks.
-
In the top menu bar, select the region where you want to create the stack, such as China (Hangzhou).
On the Stacks page, click Create Stack and select Use ROS from the drop-down list.
On the Select Template page, select a template and click Next.
On the Configure Parameters page, configure the Stack Name and Template Parameters.
In the Configure Stack Settings section, set Deletion Protection, and then click Next.
Enabled: Enables deletion protection.
Disabled: Disables deletion protection.
On the Compliance Precheck page, complete the compliance precheck and click Next.
NoteThe compliance precheck feature is available only for specific resources. For more information, see Compliance precheck.
In the Evaluate Rules section, add compliance rules.
You can add compliance rules based on the cloud resources in the ROS template.
Click Evaluate.
You can modify the template content based on the suggestions that are provided to remediate invalid resources to ensure the compliance of the resources.
On the Check and Confirm page, click Create.
Enable deletion protection for an existing stack
In the left-side navigation pane, click Stacks.
-
In the top menu bar, select the region where you want to create the stack, such as China (Hangzhou).
On the Stacks page, click the ID of the target stack in the Stack Name column.
On the Stack Information tab, in the Basic information section, turn on the Deletion Protection switch to enable deletion protection.
NoteYou can also turn off the Deletion Protection switch to disable deletion protection.
Enable deletion protection for a nested stack
You cannot directly enable deletion protection for a nested stack. You must perform this operation on its parent stack.
In the left-side navigation pane, click Stacks.
-
In the top menu bar, select the region where you want to create the stack, such as China (Hangzhou).
On the Stacks page, select the Show Nested Stacks checkbox.
On the Stacks page, click the ID of the target stack in the Stack Name column.
On the Stack Information tab, in the Basic information section, click the parent stack ID.
On the Stack Information tab of the parent stack, in the Basic information section, turn on the Deletion Protection switch to enable deletion protection.
NoteYou can also turn off the Deletion Protection switch to disable deletion protection.