Help Center/ ModelArts/ API Reference/ Model Inference/ HPA Policy/ Viewing an Auto Scaling Policy
Updated on 2026-07-24 GMT+08:00

Viewing an Auto Scaling Policy

Function

This API is used to view auto scaling policies for a deployed service. Before calling this API, ensure that the service has been deployed and a valid service ID has been obtained. After the query is successful, the policy information corresponding to the service is returned, such as the rule ID, rule name, scaling type, scaling status, scaling cron expression, and number of target instances. If the provided service ID is invalid, the parameter settings are incorrect, or the system resources are insufficient, an error message is displayed, prompting you to check the validity of the input data or contact technical support.

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

    Read

    service *

    -

    -

    -

URI

GET /v2/{project_id}/services/{service_id}/deployments/{deployment_id}/hpa

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, which can be obtained from the response body during service creation or by querying the service list. The service_id field indicates the service ID.

Constraints

N/A

Range

Service ID.

Default Value

N/A

deployment_id

Yes

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.

Constraints

N/A

Range

Deployment ID.

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

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

id

String

Definition

Auto scaling policy ID.

Range

N/A

name

String

Definition

Name of an auto scaling policy.

Range

N/A

target_resource_id

String

Definition

ID of the target to which the auto scaling policy is bound.

Range

Instance group ID.

target_resource_type

String

Definition

Type of the target to which the auto scaling policy is bound.

Range

  • GROUP: instance group

min_replicas

Integer

Definition

Minimum number of instances for auto scaling.

Range

1-128

max_replicas

Integer

Definition

Maximum number of instances for auto scaling.

Range

1-128

status

String

Definition

Status of the auto scaling policy.

Range

  • INACTIVE: disabled

  • ACTIVE: enabled

  • DELETED

workspace_id

String

Definition

Workspace ID.

Range

  • 0: default workspace ID

  • 32 characters consisting of digits and lowercase letters. For details about other space IDs, see Creating a Workspace.

hpa_rules

Array of HpaRule objects

Definition

Auto scaling rules.

Table 4 HpaRule

Parameter

Type

Description

id

String

Definition

Auto scaling rule ID.

Range

N/A

hpa_id

String

Definition

ID of the policy associated with the auto scaling rule.

Range

N/A

name

String

Definition

Auto scaling rule name.

Range

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

type

String

Definition

Auto scaling type.

Range

  • CRON_HPA: scheduled scaling policy

  • METRIC_HPA: metric-based scaling policy

schedule

String

Definition

Cron expression for executing scheduled auto scaling. The value starts at a minute level and does not support seconds.

Range

N/A

target_replicas

Integer

Definition

Number of target instances for auto scaling.

Range

1 to 128

disable

String

Definition

Specifies whether to enable the auto scaling rule.

Range

  • false

  • true

status

String

Definition

Status of the auto scaling rule.

Range

  • CREATING

  • CONFIG_SUCCESS

  • EXECUTE_SUCCESS

  • DELETED

  • FAILED

Status code: 404

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

  • Definition: ModelArts error code.

Range: N/A.

error_msg

String

Definition: Error message.

Range: N/A.

Example Requests

None

Example Responses

Status code: 200

View auto scaling policies.

{
  "id" : "85b6562d-df8b-4fec-a646-a6c8fe348185",
  "name" : "hpa_test",
  "target_resource_id" : null,
  "target_resource_type" : null,
  "status" : "ACTIVE",
  "min_replicas" : 1,
  "max_replicas" : 10,
  "hpa_rules" : [ {
    "name" : "rule_test",
    "type" : "CRON_HPA",
    "status" : "CREATING",
    "schedule" : "string",
    "target_replicas" : 2,
    "disable" : false
  }, {
    "name" : "rule_test1",
    "type" : "CRON_HPA",
    "status" : "CONFIG_SUCCESS",
    "schedule" : "string",
    "target_replicas" : 2,
    "disable" : false
  } ],
  "workspace_id" : 0
}

Status Codes

Status Code

Description

200

View auto scaling policies.

404

Resource not found.

Error Codes

See Error Codes.