Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Updating an Auto Scaling Policy

Function

This API is used to update an auto scaling policy.

URI

PUT /v2/{project_id}/autoscaling-policy/{cluster_id}

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Explanation

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

Constraints

N/A

Value range

The value must consist of 1 to 64 characters. Only letters and digits are allowed.

Default value

N/A

cluster_id

Yes

String

Explanation

Cluster ID. If this parameter is specified, the latest metadata of the cluster that has been patched will be obtained. For details about how to obtain the cluster ID, see Obtaining a Cluster ID.

Constraints

N/A

Value range

The value can contain 1 to 64 characters, including only letters, digits, underscores (_), and hyphens (-).

Default value

N/A

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

node_group_name

Yes

String

Explanation

Node group name.

Value range

This parameter is mandatory. If resource_pool_name is set to default, the auto scaling policies are created by node group. If resource_pool_name is not set to default, policies of the resource pool corresponding to the node group are created.

resource_pool_name

Yes

String

Explanation

Pool name.

Value range

This parameter is mandatory. If the cluster version does not support auto scaling for a specified resource pool, set this parameter to default. If this parameter is not default, the auto scaling policy of the specified resource pool is deleted.

auto_scaling_policy

No

AutoScalingPolicyInfo object

Explanation

Auto scaling rule. For details about the parameters, see Table 3.

Table 3 AutoScalingPolicyInfo

Parameter

Mandatory

Type

Description

auto_scaling_enable

Yes

Boolean

Explanation

Whether to enable the auto scaling rule.

Constraints

N/A

Value range

  • true: Enable the auto scaling rule.
  • false: Disable the autoscaling rule.

Default value

N/A

min_capacity

Yes

Integer

Explanation

Minimum number of nodes left in the node group.

Constraints

N/A

Value range

0-500

Default value

N/A

max_capacity

Yes

Integer

Explanation

Maximum number of nodes in the node group.

Constraints

N/A

Value range

0-500

Default value

N/A

resources_plans

No

Array of ResourcesPlan objects

Explanation

Resource plan list. If this parameter is left blank, the resource plan is disabled.

Constraints

When auto_scaling_enable is set to true, either this parameter or resources_plans must be configured. For details about this parameter, see Table 4.

rules

No

Array of Rule objects

Explanation

Auto scaling rules.

Constraints

When auto scaling is enabled, either a resource plan or an auto scaling rule must be configured. The number of records cannot exceed 10. For details, see Table 5.

tags

No

Array of Tag objects

Explanation

Auto scaling tags. For details, see Table 7. .

Constraints

The number of records cannot exceed 20.

Table 4 ResourcesPlan

Parameter

Mandatory

Type

Description

period_type

Yes

String

Explanation

Cycle type of a resource plan. This parameter can be set to daily only.

Constraints

N/A

Value range

N/A

Default value

N/A

start_time

Yes

String

Explanation

Start time of a resource plan. The value is in the format of hour:minute, indicating that the time ranges from 00:00 to 23:59.

Constraints

N/A

Value range

N/A

Default value

N/A

end_time

Yes

String

Explanation

End time of a resource plan. The format is the same as that of start_time.

Constraints

The value cannot be earlier than the start_time, and the interval between start_time and start_time cannot be less than 30 minutes.

Value range

N/A

Default value

N/A

min_capacity

Yes

Integer

Explanation

Minimum number of the preserved nodes in a node group in a resource plan.

Constraints

N/A

Value range

0-500

Default value

N/A

max_capacity

Yes

Integer

Explanation

Maximum number of the preserved nodes in a node group in a resource plan.

Constraints

N/A

Value range

0-500

Default value

N/A

effective_days

No

Array of strings

Explanation

The effective date of a resource plan. If this parameter is left blank, it indicates that the resource plan takes effect every day. The options are as follows:

MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, and SUNDAY

Constraints

N/A

Table 5 Rule

Parameter

Mandatory

Type

Description

name

Yes

String

Explanation

Name of an auto scaling rule.

Constraints

N/A

Value range

The value can contain 1 to 64 characters, including only letters, digits, underscores (_), and hyphens (-).

Rule names must be unique in a node group.

Default value

N/A

description

No

String

Explanation

Description about an auto scaling rule.

Constraints

N/A

Value range

The value can contain 0 to 1024 characters.

Default value

N/A

adjustment_type

Yes

String

Explanation

Adjustment type of an auto scaling rule.

Constraints

N/A

Value range

  • scale_out: cluster scale-out
  • scale_in: cluster scale-in

Default value

N/A

cool_down_minutes

Yes

Integer

Explanation

Cluster cooling time after an auto scaling rule is triggered, when no auto scaling operation is performed. The unit is minute.

Constraints

N/A

Value range

The value ranges from 0 to 10080. 10080 indicates the number of minutes in a week.

Default value

N/A

scaling_adjustment

Yes

Integer

Explanation

Number of nodes that can be adjusted once.

Constraints

N/A

Value range

1-100

Default value

N/A

trigger

Yes

Trigger object

Explanation

The condition for triggering a rule. For details, see Table 6.

Constraints

N/A

Table 6 Trigger

Parameter

Mandatory

Type

Description

metric_name

Yes

String

Explanation

Metric name. This triggering condition makes a judgment according to the value of the metric.

Constraints

N/A

Default value

N/A

metric_value

Yes

String

Explanation

Metric threshold to trigger a rule. The value must be an integer or a number with two decimal places.

Constraints

N/A

Value range

Only integers or numbers with two decimal places are allowed.

Default value

N/A

comparison_operator

No

String

Explanation

Metric judgment logic operator.

Constraints

N/A

Value range

  • LT: less than
  • GT: greater than
  • LTOE: less than or equal to
  • GTOE: greater than or equal to

Default value

N/A

evaluation_periods

Yes

Integer

Explanation

Number of consecutive five-minute periods, during which a metric threshold is reached

Constraints

N/A

Value range

1-288

Default value

N/A

Table 7 Tag

Parameter

Mandatory

Type

Description

key

Yes

String

Explanation

Tag key.

Constraints

N/A

Value range

  • A tag key can contain letters, digits, spaces, and special characters _.:=+-@, but cannot start or end with a space or start with _sys_.
  • The tag key of a resource must be unique.
  • It can contain a maximum of 128 Unicode characters and cannot be an empty string.

Default value

N/A

value

Yes

String

Explanation

Tag value.

Constraints

N/A

Value range

  • The value can contain letters, digits, spaces, and special characters _.:=+-@, but cannot start or end with a space or start with _sys_.
  • The value can contain a maximum of 255 Unicode characters and can be an empty string.

Default value

N/A

Response Parameters

None

Example Request

Update an auto scaling policy, set the number of node groups in node_group_1 to 0 to 5, and configure two scaling rules. If the value of YARNAppRunning is greater than or equal to 75 for one 5-minute period, add one Task node. If the value of YARNAppRunning is less than or equal to 25 for one 5-minute period, stop one Task node. The cooling duration is 20 minutes, and the aaa=bbb label is added to the involved nodes.

/v2/{project_id}/autoscaling-policy/{cluster_id}

{
  "node_group_name" : "ttt",
  "auto_scaling_policy" : {
    "auto_scaling_enable" : true,
    "min_capacity" : 0,
    "max_capacity" : 5,
    "rules" : [ {
      "name" : "default-expand-1",
      "adjustment_type" : "scale_out",
      "cool_down_minutes" : 20,
      "scaling_adjustment" : 1,
      "trigger" : {
        "metric_name" : "YARNAppRunning",
        "metric_value" : 75,
        "comparison_operator" : "GT",
        "evaluation_periods" : 1
      }
    }, {
      "name" : "default-shrink-1",
      "adjustment_type" : "scale_in",
      "cool_down_minutes" : 20,
      "scaling_adjustment" : 1,
      "trigger" : {
        "metric_name" : "YARNAppRunning",
        "metric_value" : 25,
        "comparison_operator" : "LT",
        "evaluation_periods" : 1
      }
    } ],
    "resources_plans" : [ {
      "period_type" : "daily",
      "start_time" : "06:00",
      "end_time" : "20:00",
      "min_capacity" : "0",
      "max_capacity" : "2",
      "effective_days" : null
    } ],
    "tags" : [ {
      "key" : "aaa",
      "value" : "bbb"
    } ]
  },
  "resource_pool_name" : "default"
}

Example Response

None

Status Codes

For details, see Status Codes.

Error Codes

See Error Codes.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback