All Products
Document Center

Virtual Private Cloud:DeletionProtection

Last Updated:Dec 06, 2023

Configures deletion protection for an instance.

Operation 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.


You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.


Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
  • Address

Request parameters


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.


Specifies whether to enable deletion protection. Valid values:

  • true: yes
  • false: no

The type of instance. Valid values:

  • EIP: Elastic IP Address (EIP)
  • CBWP: EIP bandwidth plan
  • NATGW: NAT gateway

The ID of the instance for which you want to enable deletion protection.


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 make sure that it is unique among all requests. ClientToken can contain only ASCII characters.

Note If you do not set this parameter, ClientToken is set to the value of RequestId. The value of RequestId may be different for each API request.

Response parameters


The ID of the request.



Sample success responses


  "RequestId": "BAAEF103-96C4-4454-9210-066F2405F511"

Error codes

HTTP status codeError codeError messageDescription
400DeletionProtection.ResourceNotExistThe resource is not exist.The resource does not exist.
400DeletionProtection.PrePaidNotSupportThe prepaid resource is not support.Subscription resources are not supported.
400DeletionProtection.TypeNotSupportThe resource is not support.This type of resource is not supported.
400DeletionProtection.AlreadyEnabledThe resource deletion protection is already enabled.Deletion protection is enabled.
400DeletionProtection.OwnerErrorThe resource owner error.The operation is not allowed because the resource does not belong to you.
404InvalidAllocationId.NotFoundSpecified allocation ID is not foundThe specified EIP does not exist. Check whether the specified value is valid.
404DeletionProtection.NotExistThe resource deletion protection is not foundDeletion protection is disabled.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-05-23The error codes of the API operation change.see changesets
Change itemChange content
Error CodesThe error codes of the API operation change.
    delete Error Codes: 400
    delete Error Codes: 404