Updated on 2026-09-01 GMT+08:00

Manual Service Scaling

Function

This API is used to scale model service instances. By calling this API, you can scale an existing service without adding a new version. Errors include permission verification errors, service status errors, and parameter verification errors.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    modelarts:service:scaleDeployment

    Read

    service *

    -

    -

    -

URI

PUT /v2/{project_id}/services/{service_id}/deployments/{deployment_name}/scale

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID. For details, see Obtaining a Project ID and Name.

Constraints

N/A

Range

Project ID.

Default Value

N/A

service_id

Yes

String

Definition

Service ID

deployment_name

Yes

String

Definition

Deployment name, which can be obtained from the response body during deployment creation. You can also obtain the deployments owned by the current user by obtaining service deployments. The name field indicates the deployment name.

Constraints

N/A

Range

N/A

Default Value

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. For details about how to obtain the token, see Obtaining a User Token Through Password Authentication.

Constraints

N/A

Range

N/A

Default Value

N/A

Content-Type

Yes

String

Definition

Message body type or format.

Constraints

N/A

Range

  • application/json

  • application/json;charset=utf-8

Default Value

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

count

Yes

Integer

Definition

Number of service instances.

Range

[1, 128]

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

id

String

Definition

Deployment ID, which you can obtain from the response body when adding the deployment or by obtaining service deployments. The deployment_id field indicates the deployment ID.

Range

Deployment ID.

name

String

Definition

Service deployment name.

infer_name

String

Definition

Deployment ID (deprecated field).

Range

N/A

create_at

String

Definition

Creation time, which is automatically generated.

Range

Millisecond-level timestamp, which is a 13-digit number.

description

String

Definition

Description.

Range

N/A

pool_id

String

Definition

Dedicated resource pool ID.

Range

N/A

framework

String

Definition

Algorithm framework.

Range

  • COMMON: common real-time service.

priority

String

Definition

Service priority.

Range

[1, 3]

secret_type

String

Definition

Secret type. You can select the secret type (dew or agency) to be used here.

Range

  • [dew: DEW secret.] (tag:hws,hws_hk,fcs)

  • agency: temporary agency credential.

status

String

Definition

Service deployment status

count

Integer

Definition

Number of service instances.

high_avail_switch

String

Definition

Specifies whether to enable HA. Once enabled, pods of different instances are evenly distributed to different nodes.

Range

N/A

true

system_log_dump_enable

String

Definition

Specifies whether to enable system log dump.

Range

N/A

false

unit_configs

Array of UnitConfig objects

Definition

Instance unit configuration.

update_at

String

Definition

Update time, which is automatically generated.

Range

Millisecond-level timestamp, which is a 13-digit number.

version

String

Definition

Current service version.

version_count

Integer

Definition

Number of service versions.

Range

N/A

weight

Integer

Definition

Weight percentage of the traffic allocated to the model. This parameter is mandatory only when the model is deployed as a real-time service.

Range

[0,100]

advanced_config

AdvancedConfig object

Definition

Advanced service deployment settings.

job_id

String

Definition

Wushan workflow ID.

Range

N/A

deployment_name

String

Definition

Service deployment name.

frozen_infos

Array of FrozenInfo objects

Definition

Freezing type returned when a service or deployment is frozen.

Table 5 UnitConfig

Parameter

Type

Description

id

String

Definition

Instance unit ID.

Range

N/A

name

String

Definition

Role name of the instance unit.

role

String

Definition

Instance unit role.

Range

  • COMMON: other roles

custom_spec

CustomResourceSpec object

Definition

Custom resource specifications.

Example

"custom_spec": {

"arch": "x86",

"cpu": 0.51,

"memory": 1024.0

},

flavor

String

Definition

Resource specifications. Select specifications based on service requirements. When specification is set to custom, the custom specifications are used. custom_spec specifies deployment specifications.

Range

N/A

flavor_display_name

String

Definition

Display name of a resource specification.

Range

N/A

image

ImageInfo object

Definition

Image configuration information, including the image path and image source.

models

Array of ModelResource objects

Definition

This parameter is discarded. You are advised to use files to configure models.

Model configuration. You can select a model and weight file to use with the image.

codes

Array of Code objects

Definition

This parameter is discarded. You are advised to use files to configure code.

Code configuration. You can select the OBS path where the code is stored.

files

Array of FileInfo objects

Definition

Model and code configuration. You can select the model and weight file to work with the image and the OBS path where the code is stored.

dumps

Array of Dump objects

Definition

Dump configuration. You can select the OBS bucket where the data is to be dumped.

count

Integer

Definition

Number of configuration instances.

Range

N/A

cmd

String

Definition

Startup command.

Range

N/A

termination_grace

TerminationGrace object

Definition

Graceful shutdown configuration.

envs

Map<String,String>

Definition

Environment variable.

readiness_health

Health object

Definition

Readiness health check.

startup_health

Health object

Definition

Health checks are enabled.

liveness_health

Health object

Definition

Liveness health check.

Range

N/A

port

Integer

Definition

Port.

Range

[1, 65535]

recovery

String

Definition

Auto-rebuild policy. When enabled, the platform will automatically rebuild pods according to the policy if they restart due to deployment configuration changes or hardware failures. If disabled, the platform will not intervene.

Range

  • Instance: Deployment replica rebuilding. Restarts the entire deployment when a fault occurs.

  • Role: Unit rebuilding. Restarts all pods within a deployment unit if any pod in that unit fails.

  • Pod: Pod rebuilding. Restarts the faulty pod if it fails.

npu_reset_enable

Boolean

Definition

Specifies whether to enable the recovery policy.

Range

  • true: The recovery policy is enabled.

  • false: The recovery policy is disabled.

group_count

Integer

Definition

Number of replicas in a unit. This parameter is invalid when deploy_type is set to SINGLE or workload_type is set to DEPLOYMENT.

Range

[1, 100] or left empty.

1

affinity

Affinity object

Definition

Node affinity scheduling.

security_config

ServiceSecurityConfig object

Definition

Container user ID/user group ID.

pool_resource_flavor

String

Definition

Node pool resource specifications.

Range

The value can contain a maximum of 128 characters.

Table 6 CustomResourceSpec

Parameter

Type

Description

gpu

Float

Definition

Number of GPUs.

Range

The value can be a decimal. It cannot be smaller than 0, with the third decimal place is rounded off.

memory

Integer

Definition

Memory size, in MB.

Range

Only integers are supported.

cpu

Float

Definition

CPU cores.

Range

The value can be a decimal. It cannot be smaller than 0.01, with the third decimal place is rounded off.

ascend

Integer

Definition

Number of Ascend chips.

Range

N/A

arch

String

Definition

Architecture type.

Range

x86/arm64.

Table 7 ImageInfo

Parameter

Type

Description

id

String

Definition

Image ID.

Range

N/A

source

String

Definition

Image type, which indicates the image source.

Range

  • SWR: SoftWare Repository for Container (SWR)

  • [IMAGE: [general image].] (tag:hws,hws_hk)

swr_path

String

Definition

Image path. The address is different when the source value is different.

Range

N/A

category

String

Definition

Flavors supported by the image.

Range

  • GPU: graphics processing unit.

  • CPU: central processing unit.

  • ASCEND: Ascend chip.

CPU

Table 8 ModelResource

Parameter

Type

Description

source

String

Definition

Code source type.

Range

The value is case-insensitive.

  • OBS: Object Storage Service

  • OBSFS: OBS file system API

  • EFS: Scalable File Service

  • LOCAL: local storage directory to which the host machine is mounted.

address

String

Definition

Code source address, which complies with the format of different storage systems.

Range

N/A

mount_path

String

Definition

Path mounted to the container. The value must start with a slash (/) and can contain hyphens (-), backslashes (), underscores (), periods (.), letters, and digits. Range The value must start and end with a slash (/) and can contain at most 255 characters. Only letters, digits, hyphens (-), and underscores () are allowed.

host_cache

Boolean

Definition

Specifies whether the model can be cached locally. This function is disabled by default.

Range

  • true: supported.

  • false: not supported.

false

efs_sub_path

String

Definition

When the storage type is EFS, subdirectories can be configured.

Range

N/A

read_only

Boolean

Definition

Specifies whether the mount permission is read-only.

Range

  • true: read only

  • false: non-read-only

os_warm_up

Boolean

Definition

OS warmup.

Range

  • true: Warmup enabled.

  • false: Warmup disabled.

source_name

String

Definition

Warmup name.

os_warm_up is set to true.

Range

The value can contain at most 64 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.

asset_id

String

Definition

Preset asset ID.

Range

The value can contain at most 64 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.

Table 9 Code

Parameter

Type

Description

source

String

Definition

Code source type.

Range

  • OBS: Object Storage Service

  • OBSFS: OBS file system API

  • EFS: Scalable File Service

address

String

Definition

Code source address, which complies with the format of different storage systems.

Range

N/A

source_id

String

Definition

Code source ID. Either this parameter or address must be specified. The SFS Turbo ID can be input only when source is set to EFS.

Range

N/A

mount_path

String

Definition

Path mounted to the container.

Range

The value must start and end with a slash (/) and can contain at most 255 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.

efs_sub_path

String

Definition

EFS subpath.

Range

N/A

read_only

Boolean

Definition

Specifies whether the mount permission is read-only.

Range

  • true: read only

  • false: non-read-only

Table 10 FileInfo

Parameter

Type

Description

source

String

Definition

Code source type.

Range

The value is case-insensitive.

  • OBS: Object Storage Service

  • OBSFS: OBS file system API

  • EFS: Scalable File Service

  • LOCAL: local storage directory to which the host machine is mounted.

address

String

Definition

Code source address, which complies with the format of different storage systems.

Range

N/A

mount_path

String

Definition

Path mounted to the container.

Range

The value must start and end with a slash (/) and can contain at most 255 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.

host_cache

Boolean

Definition

Specifies whether the model can be cached locally. This function is disabled by default.

Range

  • true: supported.

  • false: not supported.

false

efs_sub_path

String

Definition

When the storage type is EFS, subdirectories can be configured.

Range

N/A

read_only

Boolean

Definition

Specifies whether the mount permission is read-only.

Range

  • true: read only

  • false: non-read-only

os_warm_up

Boolean

Definition

OS warmup.

Range

  • true: Warmup enabled.

  • false: Warmup disabled.

source_name

String

Definition

Warmup name.

os_warm_up is set to true.

Range

The value can contain at most 64 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.

Table 11 Dump

Parameter

Type

Description

source

String

Definition

Source type of the dump mount directory.

Range

  • OBS: Object Storage Service (tag:hws,hws_hk)

  • OBSFS: OBS file system API

address

String

Definition

Source address of the dump mount directory. The value can be an HTTPS or OBS address.

Range

N/A

mount_path

String

Definition

Path mounted to the container. The value must start with a slash (/) and can contain hyphens (-), backslashes (), underscores (_), periods (.), letters, and digits.

Range

N/A

Table 12 TerminationGrace

Parameter

Type

Description

pre_stop_cmd

String

Definition: The shutdown command is triggered when the container receives a stop signal, but it must be completed within the grace period or the shutdown times out. If this happens, the container will be forcefully stopped. You can use this command to perform operations such as closing database connections, releasing file handles, and stopping child processes.

Range

  • Protocol: http or https

  • Port: 1 to 65535

  • Address: Only letters, digits, periods (.), hyphens (-), underscores (_), and slashes (/) are allowed. The value cannot start with a slash (/).

termination_grace_period_seconds

Integer

Definition

This parameter indicates the maximum length of time that can pass between when a Pod receives a stop signal to when it is forcefully stopped. It is used for the Pod to perform cleanup operations (such as closing connections, releasing resources, and saving states).

Range

  • Protocol: http or https

  • Port: 1 to 65535

  • Address: Only letters, digits, periods (.), hyphens (-), underscores (_), and slashes (/) are allowed. The value cannot start with a slash (/).

Table 13 Health

Parameter

Type

Description

check_method

String

Definition

Health check method, which can be HTTP or EXEC (commands).

Range

  • HTTP: Hypertext Transfer Protocol

  • EXEC: commands

check_method is not specified, the default value is check_method.

During update, if check_method is not specified, an error will be reported.

cmd

String

Definition

Command line mandatory when the health check method is EXEC.

Range

N/A

url

String

Definition

Request address mandatory when the health check mode is HTTP.

Range

N/A

protocol

String

Definition

Connection protocol. The default value is HTTP.

Range

  • HTTPS: Hypertext Transfer Protocol Secure

  • HTTP: Hypertext Transfer Protocol

  • WSS: WebSocket Secure

  • WS: WebSocket

initial_delay_seconds

Integer

Definition

Waiting time before the first detection. The default value is 30 and the minimum value is 1.

Range

N/A

30

timeout_seconds

Integer

Definition

Timeout interval of the detection. The default value is 30 seconds, and the minimum value is 1 second.

Range

The minimum value is 1 second.

period_seconds

Integer

Definition

Interval at which the health check is performed. The default value is 10 seconds, and the minimum value is 1 second.

Range

The minimum value is 1 second.

failure_threshold

Integer

Definition

The minimum number of consecutive detection failures required after a successful detection. Detection is considered failed only when this threshold is reached. The default value is 3. The minimum value is 1.

Range

The minimum value is 1.

3

Table 14 Affinity

Parameter

Type

Description

affinity_type

String

Definition

Node affinity type.

Range

  • AFFINITY: affinity

  • ANTI_AFFINITY: anti-affinity

required

Boolean

Definition

Specifies whether to set strong affinity.

Range

  • true: Strong affinity is set.

  • false: Strong affinity is not set.

selection_mode

String

Definition

Node selection mode.

Range

IP

targets

Map<String,String>

Definition

List selected using the preceding method, whose length cannot exceed 20.

Table 15 ServiceSecurityConfig

Parameter

Type

Description

user_id

Long

Definition

user_id set during service container startup. This parameter can be left empty by default.

Range

[1, 60000]

group_id

Long

Definition

group_id set during service container startup. This parameter can be left empty by default.

Range

[1, 60000]

Table 16 AdvancedConfig

Parameter

Type

Description

deploy_timeout_minutes

String

Definition

Deployment timeout.

upgrade_config

UpgradeConfig object

Definition

Rolling upgrade configuration.

service_secret

ServiceSecret object

Definition

Service secret.

dynamic_routing_enable

Boolean

Definition

Intelligent routing switch.

strategy

String

Definition

Intelligent routing policy.

ems_enable

Boolean

Definition

EMS acceleration switch.

metric_api_scheme

String

Definition

Intelligent routing metric collection scheme.

metric_api_port

String

Definition

Intelligent routing metric collection port.

metric_api_path

String

Definition

Intelligent routing metric collection URL.

custom_metrics_path

String

Definition

Custom metric collection URL.

port

Integer

Definition

Container port.

protocol

String

Definition

Container request protocol. When WSS or WS is selected, the service API is upgraded to WebSocket. WebSocket cannot be enabled together with Traffic Limit.

Range

  • HTTP: HTTP protocol

  • HTTPS: HTTPS protocol

  • WSS: WebSocket Secure protocol

  • WS: WebSocket protocol

  • TCP: Transmission Control Protocol

  • NA: No protocol used

Table 17 UpgradeConfig

Parameter

Type

Description

type

String

Definition

Upgrade type.

Range

  • ROLLING: rolling upgrade (default value)

rolling_update

RollingUpdate object

Definition

Rolling update configuration.

Table 18 RollingUpdate

Parameter

Type

Description

max_surge

String

Definition

Maximum number of pods that can be started during rolling update.

Range

1/ %to 100%

1%.

max_unavailable

String

Definition

Maximum number of pods that can be deleted during rolling update.

Range

1/ %to 100%

1%.

Table 19 ServiceSecret

Parameter

Type

Description

secret_enable

Boolean

Definition

Specifies whether to enable the key.

Range

  • true: The secret is enabled.

  • false: The secret is disabled.

false

secret_type

String

Definition

Secret type.

Range

  • custom: custom secret.

  • [dew: DEW secret.] (tag:hws,hws_hk,fcs)

secret_volumes

Array of SecretVolume objects

Definition

Secret volume mounting.

group_enable

Boolean

Definition

Specifies whether to enable the image user group.

Range

  • true: The user group of the image is enabled.

  • false: The user group of the image is not enabled.

false

group_id

Long

Definition

User group ID of the image.

Range

1000 to 4294967294

Table 20 SecretVolume

Parameter

Type

Description

secret_name

String

Definition

Secret name.

Range

N/A

secret_key

String

Definition

Secret key.

Range

N/A

secret_value

String

Definition

Secret value.

Range

N/A

mount_path

String

Definition

Mount path.

Range

The value must start and end with a slash (/) and can contain at most 255 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.

Table 21 FrozenInfo

Parameter

Type

Description

scene

String

Freezing scenario. Options:

  • ARREAR: frozen due to arrears

  • POLICE: frozen due to public security issues

  • ILLEGAL: frozen due to abuse

effect

Integer

Impacts of freezing. Options:

  • 1: can be released after being frozen

  • 2: cannot be released after being frozen

Example Requests

Modify the number of instances.

PUT https://{endpoint}/v2/{project_id}/services/{service_id}/deployments/{deployment_name}/scale

{
  "count" : 1
}

Example Responses

Status code: 200

The service scaling is successful.

{
  "deployment_name" : "instance-35cb",
  "status" : "running",
  "count" : 2
}

Status Codes

Status Code

Description

200

The service scaling is successful.

Error Codes

See Error Codes.