If you use a pay-as-you-go Elastic Compute Service (ECS) instance to deploy critical business or store important data or configurations, we recommend that you enable release protection for the instance to prevent accidental release of the instance, which may cause irreparable consequences. After release protection is enabled for the instance, you cannot manually release the instance in the ECS console, by calling API operations, or by using the CLI. This topic describes how to configure release protection for ECS instances.
Prerequisites
The instances for which you want to enable or disable release protection are pay-as-you-go instances.
Considerations
Release protection cannot prevent the automatic release of instances that is triggered by normal reasons, such as the following reasons:
A payment in your Alibaba Cloud account is overdue for more than 15 days.
The automatic release time that you specified for the instance arrives.
The instance does not comply with applicable security compliance policies.
The instance was automatically created by Auto Scaling and is removed during subsequent scale-in events.
Impact of instance release protection
When you attempt to manually release instances in the ECS console, instances for which release protection is enabled are automatically skipped.
Enable or disable release protection for instances
By default, release protection is disabled for instances. You can enable or disable release protection for instances when you create the instances or after the instances are created.
Scenario 1: Enable or disable release protection for existing instances
After you create pay-as-you-go instances, you can enable or disable release protection for the instances.
Log on to the ECS console.
In the left-side navigation pane, choose .
In the top navigation bar, select the region and resource group to which the resource belongs.
On the Instance page, enable or disable release protection for a single instance or multiple instances.
To enable or disable release protection for a single instance, find the instance and choose > Instance Attributes > Enable Release Protection or Disable Release Protection in the Actions column. In the Enable Release Protection or Disable Release Protection message, click OK.
To enable or disable release protection for multiple instances at a time, select the instances and choose More > Instance Attributes > Enable Release Protection or Disable Release Protection. In the message that appears, click OK.
Scenario 2: Enable or disable release protection when you create instances
When you create instances, release protection is disabled for the instances by default. You can manually enable release protection.
On the instance buy page, set the billing method to Pay-as-you-go and show the Advanced Settings(Optional) section. For the Release Protection parameter, select Prevent Instances from Being Accidentally Released by Using the ECS Console or by Calling an API Operation.
Check whether release protection is enabled for an instance
On the Instance page, click the ID of the instance that you want to manage to go to the Instance Details page. In the Other Information section, view the value of the Release Protection field.
Yes: Release protection is enabled for the instance.
No: Release protection is disabled for the instance.
References
You can also call the following API operations to enable or disable release protection for instances:
ModifyInstanceAttribute: You can specify the
DeletionProtection
parameter to enable or disable release protection for existing instances.RunInstances or CreateInstance: You can specify the
DeletionProtection
parameter to enable or disable release protection for instances that you want to create.NoteIf you call the DeleteInstance operation to release an instance for which release protection is enabled, the error code
InvalidOperation.DeletionProtection
is returned.
If you no longer need an instance for which release protection is enabled, you can disable release protection for the instance and then release the instance. For information about how to release an instance, see Release an instance.
NoteYou can specify an automatic release time for an instance after you disable release protection for the instance. The instance is automatically released at the specified time. For more information, see Release an instance or ModifyInstanceAutoReleaseTime.