Enables deletion protection for an instance.
Description
After you enable deletion protection for an instance, you cannot delete the instance. You must disable deletion protection before you can delete the instance.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | DeletionProtection |
The operation that you want to perform. Set the value to DeletionProtection. |
InstanceId | String | Yes | eip-uf6id7gvguruxe41v**** |
The ID of the instance for which you want to enable deletion protection. |
ProtectionEnable | Boolean | Yes | true |
Specifies whether to enable deletion protection. Valid values:
|
RegionId | String | Yes | cn-hangzhou |
The ID of the region where the instance for which you want to enable deletion protection is deployed. You can call the DescribeRegions operation to query region IDs. |
Type | String | Yes | EIP |
The type of instance. Valid values:
|
ClientToken | String | No | 123e4567-e89b-12d3-a456-426655440000 |
The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must ensure that it is unique among different requests. ClientToken can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How can I ensure idempotence? |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | BAAEF103-96C4-4454-9210-066F2405F511 |
The ID of the request. |
Examples
Sample requests
http(s)://vpc.aliyuncs.com/?Action=DeletionProtection
&InstanceId=eip-uf6id7gvguruxe41v****
&ProtectionEnable=true
&RegionId=cn-hangzhou
&Type=EIP
&<Common request parameters>
Sample success responses
XML
format
<DeletionProtectionResponse>
<RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>
</DeletionProtectionResponse>
JSON
format
{
"RequestId":"CEF72CEB-54B6-4AE8-B225-F876FF7BA984"
}
Error codes
HttpCode | Error code | Error message | Description |
---|---|---|---|
404 | InvalidAllocationId.NotFound | Specified allocation ID is not found | The error message returned because the specified EIP does not exist. Check whether the specified value of the parameter is valid. |
For a list of error codes, visit the API Error Center.