Sets deletion protection for an instance.

Before you begin

After enabling deletion protection for an instance, you cannot delete the instance. To delete the instance, you must first disable deletion protection.

Make the API call

You can use OpenAPI Explorer to make API calls, search for API calls, perform debugging, and generate SDK example code.

Request parameters

Parameter Type Required? Example value Description
Action String  Yes DeletionProtection

The action to perform. Valid value: DeletionProtection.

InstanceId String  Yes eip-uf6id7gvguruxe41v****

The ID of the instance to have deletion protection enabled.

ProtectionEnable Boolean Yes true

Indicates whether to enable deletion protection. Valid values:

  • true: Enable.
  • false: Disable.
RegionId String  Yes cn-hangzhou

The region ID of the instance to have deletion protection enabled. You can call DescribeRegions to view the latest list of Alibaba Cloud regions.

Type String  Yes EIP

The type of the instance to have deletion protection enabled. Valid values:

  • EIP: Elastic IP Address (EIP).
  • CBWP: Internet Shared Bandwidth.
  • NATGW: NAT Gateway.
ClientToken String  No 123e4567-e89b-12d3-a456-426655440000

The client token that guarantees the idempotence of the request. The value of this parameter is generated by the client and is unique among different requests. The ClientToken can contain only ASCII characters, and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

Response parameters

Parameter Type Example value Description
RequestId String  BAAEF103-96C4-4454-9210-066F2405F511

The ID of the request.

Examples

Request example


http(s)://vpc.aliyuncs.com/? Action=DeletionProtection
&InstanceId=eip-uf6id7gvguruxe41v****
&ProtectionEnable=true
&RegionId=cn-hangzhou
&Type=EIP
&<CommonParameters>

Response example

XML format

<DeletionProtectionResponse>
        <RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>
</DeletionProtectionResponse>

JSON format

{
	"RequestId":"CEF72CEB-54B6-4AE8-B225-F876FF7BA984"
}

Errors

HTTP status code Error code Error message Description
404 InvalidAllocationId.NotFound Specified allocation ID is not found The specified public IP address does not exist.

For a list of error codes, visit the API Error Center.