Updated on 2024-04-16 GMT+08:00

Modifying the Specifications of an ECS

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.

This API is an asynchronous API. After the specifications modification request is successfully delivered, a job ID is returned. This does not mean the modification is complete. You need to call the API by referring to Querying Task Execution Status to query the job status. The SUCCESS status indicates that the modification is successful.

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 are not 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 after the check is passed.

Table 3 resize field description

Parameter

Mandatory

Type

Description

flavorRef

Yes

String

Specifies the flavor ID of the ECS after the modification.

mode

No

String

If the parameter value is withStopServer, the specifications of a running ECS can be modified.

If the parameter value is withStopServer, the modification process is as follows: The system automatically stops the ECS, modifies ECS specifications, and starts the ECS after the modification is complete.

Response

See Responses (Task).

Example Request

Change the ECS flavor to c3.15xlarge.2.

POST https://{endpoint}/v1/{project_id}/cloudservers/{server_id}/resize

{
"resize": {
        "flavorRef": "c3.15xlarge.2"
    }
}

Example Response

{      
    "job_id": "ff80808288d41e1b018990260955686a" 
} 

Error Codes

See Error Codes.