Enables deletion protection for an instance.


After you enable deletion protection for an instance, you cannot delete the instance. You must disable deletion protection before you can delete the instance.


OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

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:

  • true: enables deletion protection.
  • false: disables deletion protection.
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:

  • EIP: an elastic IP address (EIP)
  • CBWP: an EIP bandwidth plan
  • NATGW: a NAT gateway
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.


Sample requests

&<Common request parameters>

Sample success responses

XML format


JSON format


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.