Help Center/ Elastic Cloud Server/ API Reference/ APIs/ Batch Operations/ Batch Modifying ECS Specifications
Updated on 2025-09-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.

URI

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

Table 1 lists the URI parameters.
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.

Request

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

Table 3 resize field description

Parameter

Mandatory

Type

Description

flavorRef

Yes

String

Specifies the flavor ID of the ECS after the modification.

servers

Yes

Array of objects

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

mode

No

String

Specifies the mode of modifying specifications.

  • withStopServer indicates that stop the ECS first and then modify specifications.

cpu_options

No

Object

Specifies the CPU options.

For details, see Table 5.

promotion

No

Object

Specifies the discount. For details, see Table 6.

Table 4 servers field description

Parameter

Mandatory

Type

Description

id

Yes

String

Specifies the ECS ID.

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

Specifies the type.

id

Yes

String

Specifies the ID.

Response

Table 7 describes the response parameters.

Table 7 Response parameters

Parameter

Mandatory

Type

Description

job_id

Yes

String

Specifies the job ID.

order_id

No

String

Specifies the order ID.

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.