Configures deletion protection for an instance.
Usage notes
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 |
---|---|---|---|---|
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 the most recent region list. |
ProtectionEnable | Boolean | Yes | true | Specifies whether to enable deletion protection. Valid values:
|
Type | String | Yes | EIP | The instance type. Valid values:
|
InstanceId | String | Yes | eip-uf6id7gvguruxe41v**** | The ID of the instance for which you want to enable deletion protection. |
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 token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters. Note If you do not specify this parameter, the system automatically uses the client token as the request ID. The request ID may be different for each API request. |
Action | String | Yes | DeletionProtection | The operation that you want to perform. Set the value to DeletionProtection. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | BAAEF103-96C4-4454-9210-066F2405F511 | The request ID. |
Examples
Sample requests
http(s)://[Endpoint]/?RegionId=cn-hangzhou
&ProtectionEnable=true
&Type=EIP
&InstanceId=eip-uf6id7gvguruxe41v****
&ClientToken=123e4567-e89b-12d3-a456-426655440000
&Action=DeletionProtection
&Common request parameters
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<DeletionProtectionResponse>
<RequestId>BAAEF103-96C4-4454-9210-066F2405F511</RequestId>
</DeletionProtectionResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "BAAEF103-96C4-4454-9210-066F2405F511"
}
Error codes
HttpCode | Error code | Error message | Description |
---|---|---|---|
400 | DeletionProtection.ResourceNotExist | The resource is not exist. | The error message returned because the specified resource does not exist. |
400 | DeletionProtection.PrePaidNotSupport | The prepaid resource is not support. | The error message returned because subscription resources are not supported. |
400 | DeletionProtection.TypeNotSupport | The resource is not support. | The error message returned because this type of resource is not supported. |
400 | DeletionProtection.AlreadyEnabled | The resource deletion protection is already enabled. | The error message returned because deletion protection is enabled. |
400 | DeletionProtection.OwnerError | The resource owner error. | The error message returned because the resource does not belong to you and the operation is denied. |
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 is valid. |
404 | DeletionProtection.NotExist | The resource deletion protection is not found | The error message returned because deletion protection is disabled. |
For a list of error codes, see Service error codes.