Help Center/ Elastic Cloud Server/ API Reference/ APIs/ Status Management/ Modifying the Specifications of an ECS (Pay-per-Use)
Updated on 2025-12-10 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.

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 Job Execution Status to query the job status. The SUCCESS status indicates that the modification is successful.

Huawei Cloud no longer provides Windows images. This API cannot be used to modify the specifications of Windows ECSs.

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.

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:resize

write

instance *

ecs:FlavorId

-

-

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

Definition

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

Constraints

N/A

Range

N/A

Default Value

N/A

dry_run

No

Boolean

Definition

Specifies whether to check the request. If this parameter is set to true, no instance is created.

Constraints

N/A

Range

  • true: Check the request. Check items include the 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: Send the request without checking the request body.

Default Value

false

Table 3 resize field description

Parameter

Mandatory

Type

Description

flavorRef

Yes

String

Definition

Specifies the flavor ID of the ECS after the modification.

You can view Listing Supported Flavor Changes to query the target flavors to which a specified ECS flavor can be changed.

Constraints

N/A

Range

N/A

Default Value

N/A

cpu_options

No

Object

Definition

Specifies the CPU options.

For details, see Table 4.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 4 cpu_options field description

Parameter

Mandatory

Type

Description

hw:cpu_threads

No

Integer

Definition

Specifies whether to enable CPU hyper-threading.

Constraints

This parameter can be set to 1 (disabling hyper-threading) only when all of the following conditions are met:

  • The ECS is being created or resized.
  • The extra_specs parameter of the target flavor contains:
    • hw:cpu_policy, whose value is set to dedicated
    • hw:cpu_threads, whose value is set to 2

Range

  • 1: Disable hyper-threading.
  • 2: Enable hyper-threading.

Default Value

N/A

Response

Table 5 describes the response parameters.

Table 5 Response parameters

Parameter

Type

Description

job_id

String

Definition

Specifies the job ID returned after a job is delivered. The job ID can be used to query the job execution progress. For details about how to query the job execution status based on job_id, see Job Status Management.

Range

N/A

For details about abnormal responses, see Responses (Jobs).

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.