Help Center/ Elastic Cloud Server/ API Reference/ APIs/ Status Management/ Setting the Scheduled Deletion Time of ECSs
Updated on 2025-12-10 GMT+08:00

Setting the Scheduled Deletion Time of ECSs

Function

This API is used to set the scheduled deletion time for pay-per-use ECSs. If the deletion time is set to an empty string, the scheduled deletion is canceled.

This API supports fine-grained permissions for enterprise projects. For details, see ecs:cloudServers:setAutoTerminateTime.

Debugging

You can debug this API in API Explorer.

Authorization

Each account has all of the permissions required to call all APIs, but IAM users must have the required permissions specifically assigned.
  • If you are using role/policy-based authorization, see the required permissions in Permissions and Supported Actions.
  • If you are using identity policy-based authorization, the permissions listed below are required.

Action

Access Level

Resource Type (*: required)

Condition Key

Alias

Dependencies

ecs:cloudServers:setAutoTerminateTime

write

instance *

-

-

-

URI

POST /v1/{project_id}/cloudservers/{server_id}/actions/update-auto-terminate-time

Table 1 describes the parameters in the URI.
Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

For details about how to obtain the ID, see Obtaining a Project ID.

server_id

Yes

Specifies the ECS ID.

Request

Table 2 Request parameters

Parameter

Mandatory

Type

Description

auto_terminate_time

Yes

String

Definition

Specifies the scheduled deletion time for pay-per-use ECSs.

Constraints

  • If the value of second (ss) is not 00, the system automatically sets to the current value of minute (mm).
  • The scheduled deletion time must be at least half an hour later than the current time.
  • The scheduled deletion time cannot be three years later than the current time.
  • If the value of auto_terminate_time is an empty string, the scheduled deletion is not set or canceled.

Range

The value is in the format of "yyyy-MM-ddTHH:mm:ssZ" in UTC+0 and complies with ISO8601.

Example: 2020-09-25T12:05:00Z

Default Value

N/A

Response

None

Example Request

  • Set the scheduled deletion time for an ECS to 2020-09-25T12:05:00Z.
    POST  https://{endpoint}/v1/{project_id}/cloudservers/{server_id}/actions/update-auto-terminate-time
    
    {
        "auto_terminate_time": "2020-09-25T12:05:00Z"
    }
  • Cancel the scheduled deletion for an ECS.
    POST  https://{endpoint}/v1/{project_id}/cloudservers/{server_id}/actions/update-auto-terminate-time
    
    {
        "auto_terminate_time": ""
    }

Example Response

None

Returned Values

For details, see Returned Values for General Requests.

Error Codes

For details, see Error Codes.