Updated on 2026-03-19 GMT+08:00

Batch Modifying ECS Specifications

Function

This API is used to batch modify ECS specifications.

This API is an asynchronous API. After the batch specification modification request is successfully submitted, 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 specifications for a maximum of 50 ECSs in a batch.
  • The billing modes of ECSs whose specifications are to be modified in the same batch must be the same.
  • The specifications of yearly/monthly ECSs can be batch upgraded or downgraded.
  • The ECSs whose specifications are to be modified in the same batch must be located in the same AZ.
  • The current and new specifications of the ECSs whose specifications are to be modified in the same batch must be the same.
  • The specifications of ECSs on DeHs cannot be batch modified.
  • The specifications of spot instances cannot be batch modified.
  • Auto-payment is not supported for batch upgrade of specifications for yearly/monthly ECSs. You can manually pay for the generated order on the console or refer to Paying Yearly/Monthly Product Orders to pay for the order.
  • The specifications of yearly/monthly ECSs created using paid public images cannot be batch modified. For details about paid public images, see Image Billing.

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 *

  • g:ResourceTag/<tag-key>
  • g:EnterpriseProjectId
  • ecs:FlavorId

-

-

URI

POST /v1/{project_id}/cloudservers/batch-resize

Table 1 lists the URI parameters.
Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Definition

Specifies the project ID.

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

Constraints

N/A

Range

N/A

Default Value

N/A

Request

Table 2 lists 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

Table 3 resize field description

Parameter

Mandatory

Type

Description

flavorRef

Yes

String

Definition

Specifies the flavor ID of the ECS after the modification.

Constraints

N/A

Range

N/A

Default Value

N/A

servers

Yes

Array of objects

Definition

Specifies the ECS ID list. For details, see Table 4.

Constraints

N/A

Range

N/A

Default Value

N/A

mode

No

String

Definition

The specification modification request can be submitted at ECS runtime.

Constraints

N/A

Range

When mode is set to withStopServer, the system will stop the running ECS first before modifying specifications and then start the ECS after the modification is complete.

Default Value

N/A

cpu_options

No

Object

Definition

Specifies the CPU options.

For details, see Table 5.

Constraints

N/A

Range

N/A

Default Value

N/A

promotion

No

Object

Definition

Specifies the discount. For details, see Table 6.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 4 servers field description

Parameter

Mandatory

Type

Description

id

Yes

String

Definition

Specifies the ECS ID.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 5 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

Table 6 promotion field description

Parameter

Mandatory

Type

Description

type

Yes

String

Definition

Specifies the type.

Constraints

N/A

Range

N/A

Default Value

N/A

id

Yes

String

Definition

Specifies the ID.

Constraints

N/A

Range

N/A

Default Value

N/A

Response

Table 7 describes the response parameters.

Table 7 Response parameters

Parameter

Mandatory

Type

Description

job_id

Yes

String

Definition

Specifies the job ID.

Range

N/A

order_id

No

String

Definition

Specifies the order ID.

Range

N/A

Example Request

Batch modify the specifications of two ECSs to s3.small.1.

POST https://{endpoint}/v1/{project_id}/cloudservers/batch-resize

{
	"resize": {
		"flavorRef": "s3.small.1",
		"servers": [
			{
				"id": "98ce4563-3e06-414f-899b-6ba6eaa41c1d"
			},
			{
				"id": "aacc5bf0-49c4-4720-a406-1751d8010e7f"
			}
		]
	}
}

Example Response

{
    "job_id": "ff80808288d415d80189901d8eb81cbb",
    "order_id": "CS18020810083A4GP"
}

Error Codes

See Error Codes.