Help Center/ Elastic Cloud Server/ API Reference/ APIs (Recommended)/ Status Management/ Modifying the Specifications of an ECS (Pay-per-Use)
Updated on 2023-05-29 GMT+08:00

Modifying the Specifications of an ECS (Pay-per-Use)

Function

ECS specifications can be modified, for example, upgrading the vCPUs and memory, to meet service requirements. This API is used to modify ECS specifications.

Constraints

  • You can modify the ECS specifications only when the ECS is stopped.
  • This API cannot be used to modify the specifications of a yearly/monthly ECS. For details about how to modify the specifications of a yearly/monthly ECS, see Modifying the Specifications of an ECS.
  • Spot ECSs do not support specifications modification.

URI

POST /v1/{project_id}/cloudservers/{server_id}/resize

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 describes the request parameters.
Table 2 Request parameters

Parameter

Mandatory

Type

Description

resize

Yes

Object

Specifies the operation to modify ECS specifications. For details, see Table 3.

dry_run

No

Boolean

Specifies whether to only check the request and not modify the ECS specifications.

true: The request is sent and the ECS specifications will not be modified. Check items include mandatory parameters and request format.

  • If the check fails, the system returns an error.
  • If the check is successful, the system returns status code 202.

false: The request is sent and the ECS specifications will be modified if the check is successful.

Table 3 resize field description

Parameter

Mandatory

Type

Description

flavorRef

Yes

String

Specifies the flavor ID of the ECS after the modification.

You can view Querying the Target ECS Flavors to Which a Flavor Can Be Changed to query the target flavors to which a specified ECS flavor can be changed.

Response

See Responses (Task).

Example Request

POST https://{endpoint}/v1/{project_id}/cloudservers/{server_id}/resize
{
"resize": {
        "flavorRef": "c3.15xlarge.2"
    }
}

Example Response

{      
    "job_id": "70a599e0-31e7-49b7-b260-868f441e862b" 
} 

Error Codes

See Error Codes.