All Products
Search
Document Center

Virtual Private Cloud:DeletionProtection

Last Updated:Mar 04, 2024

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.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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
vpc:DeletionProtectionWrite
  • Address
    acs:vpc:{#regionId}:{#accountId}:eip/{#AllocationId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

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.

cn-hangzhou
ProtectionEnablebooleanYes

Specifies whether to enable deletion protection. Valid values:

  • true: yes
  • false: no
true
TypestringYes

The type of instance. Valid values:

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

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

eip-uf6id7gvguruxe41v****
ClientTokenstringNo

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.
123e4567-e89b-12d3-a456-426655440000

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

BAAEF103-96C4-4454-9210-066F2405F511

Examples

Sample success responses

JSONformat

{
  "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 code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 404