Updated on 2026-10-15 GMT+08:00

Creating an AS Group

Function

An AS group is a collection of instances that are used in the same scenario. It is the basis for enabling or disabling AS policies and performing scaling actions. An AS group specifies parameters, such as the maximum number of instances, expected number of instances, minimum number of instances, VPC, subnet, and load balance settings.

  • Each account can create a maximum of 10 AS groups by default.
  • If a load balancer is associated with an AS group, AS automatically associates the load balancer with or dissociates the load balancer from instances when the instances are added to or removed from the AS group.
  • If ELB health check is enabled for an AS group, the instances in the AS group must use all the listening ports of each load balancer for health check. You can configure these ports in the security group of the instances. For details, see Adding a Security Group Rule.
    • If you add multiple load balancers to an AS group, an instance is considered healthy only when all load balancers declare that it is healthy. If any load balancer detects that the instance is unhealthy, the instance will be removed from the AS group.
    • If you add a load balancer that has multiple listening ports to an AS group, an instance is considered healthy only when all the ports detect the instance is healthy. If the instance is detected unhealthy by any of the ports, the instance will be removed from the AS group.
  • If you add a load balancer that has multiple listening ports to an AS group, you are advised to create AS policies based on ECS metrics, rather than network metrics or application metrics. If a network metric or an application metric is used, scale-out and scale-in actions may happen at the same time.
  • If you add a load balancer that has multiple listening ports to an AS group, AS can complete a scale-out or scale-in action only when the load balancer listens or no longer listens on all these ports on the instances to be added or removed. Otherwise, AS will release the instances to be added and create new ones in the scale-out action or will not release the instances to be removed in the scale-in action.

Authorization

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

URI

POST /autoscaling-api/v1/{project_id}/scaling_group

Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Specifies the project ID. For details, see Obtaining a Project ID.

Constraints

N/A

Range

N/A

Default Value

N/A

Request

Table 2 Request parameters

Parameter

Mandatory

Type

Description

scaling_group_name

Yes

String

Definition

Specifies the AS group name.

Constraints

N/A

Range

It contains 1 to 64 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

Default Value

N/A

scaling_configuration_id

Yes

String

Definition

Specifies the AS configuration ID, which can be obtained using the API for querying AS configurations. For details, see Querying AS Configurations.

Constraints

N/A

Range

N/A

Default Value

N/A

desire_instance_number

No

Integer

Definition

Specifies the expected number of instances.

Constraints

The value must be no less than the minimum number of instances and no greater than the maximum number of instances.

Range

N/A

Default Value

The default value is the minimum number of instances.

min_instance_number

No

Integer

Definition

Specifies the minimum number of instances.

Constraints

Minimum number of instances ≤ Expected number of instances ≤ Maximum number of instances

Range

N/A

Default Value

0

max_instance_number

No

Integer

Definition

Specifies the maximum number of instances.

Constraints

Minimum number of instances ≤ Expected number of instances ≤ Maximum number of instances

Range

An integer from 0 to 300

Default Value

1

cool_down_time

No

Integer

Definition

Specifies the cooldown period, in seconds.

After a scaling action is complete, the cooldown period starts.

NOTE:
  • When an AS group scales out, scale-in requests triggered manually or by scheduled and periodic policies will be executed immediately after the scale-out is complete, without being affected by the cooldown period.
  • When an AS group scales in, scale-out requests triggered manually or by scheduled and periodic policies will be executed immediately after the scale-in is complete, without being affected by the cooldown period.

Constraints

During the cooldown period, AS denies all scaling requests triggered by alarm-based policies. Scaling requests triggered manually or by scheduled or periodic policies are not affected.

Range

0s to 86,400s

Default Value

300s

lb_listener_id

No

String

Definition

Specifies the load balancer listener ID. For how to obtain a listener ID, see Querying Load Balancers.

Constraints

  • A maximum of six load balancer listeners can be added. Multiple listener IDs are separated by commas (,).
  • This field is mutually exclusive with lbaas_listeners.

Range

N/A

Default Value

N/A

lbaas_listeners

No

Array of lbaas_listeners objects

Definition

Specifies load balancers. For details, see Table 3. For how to obtain information about a load balancer, see Querying Backend Server Groups.

Constraints

  • A maximum of six load balancers can be added.
  • This field is mutually exclusive with lb_listener_id.

available_zones

No

Array of strings

Definition

Specifies AZ information. The ECSs added in a scaling action will be created in a specified AZ. If you do not specify an AZ, the system automatically specifies one. For details, see Regions and Endpoints.

Constraints

You can change the AZ of an AS group only when no scaling action is being performed in the group.

networks

Yes

Array of networks objects

Definition

Specifies network information. The first subnet you specify is where ECS primary NICs are created by default. That is, the NIC associated with the first subnet is the primary NIC. Other subnets are for ECS extended NICs. For details about how to obtain subnet information, see Querying Subnets. For details about the data structure, see Table 4.

Constraints

A maximum of five subnets can be selected.

security_groups

No

Array of security_groups objects

Definition

Specifies security group information. For how to obtain security group information, see Querying Security Groups. For the information about the data structure, see Table 7.

If a security group is specified both in the AS configuration and the AS group, scaled-out instances will be added to the security group specified in the AS configuration. If a security group is not specified in either of them, scaled-out instances will be added to the default security group. For your convenience, specify a security group in the AS configuration.

Constraints

Only one security group can be selected.

vpc_id

Yes

String

Definition

Specifies the VPC ID. For details, see Querying VPCs.

Constraints

N/A

Range

N/A

Default Value

N/A

health_periodic_audit_method

No

String

Definition

Specifies the health check method for instances in the AS group.

Constraints

If ELB is not configured for an AS group, the ELB_AUDIT method cannot be used.

Range

ELB_AUDIT and NOVA_AUDIT

  • ELB_AUDIT: indicates the ELB health check, which takes effect in an AS group with a listener.
  • NOVA_AUDIT: indicates the ECS health check, which is the health check method that comes with AS.

Default Value

For an AS group with ELB configured, the default value is ELB_AUDIT.

In other cases, the default value is NOVA_AUDIT.

health_periodic_audit_time

No

Integer

Definition

Specifies the health check interval, in minutes.

Constraints

N/A

Range

The value can be 1, 5, 15, 60, or 180 minutes. If the value is set to 0, health check can be performed every 10 seconds.

Default Value

The default value is 5 minutes.

health_periodic_audit_grace_period

No

Integer

Definition

Specifies the health check grace period, in seconds.

The health check grace period starts after an instance is added to an AS group and is enabled. The AS group will start checking the instance health only after the grace period ends.

Constraints

This parameter is valid only when the instance health check method of the AS group is ELB_AUDIT.

Range

0s to 86,400s

Default Value

The default value is 600s.

instance_terminate_policy

No

String

Definition

Specifies the instance removal policy.

Constraints

N/A

Range

  • OLD_CONFIG_OLD_INSTANCE (default): The earlier-created instances based on the earlier-created AS configurations are removed first.
  • OLD_CONFIG_NEW_INSTANCE: The later-created instances based on the earlier-created AS configurations are removed first.
  • OLD_INSTANCE: The earlier-created instances are removed first.
  • NEW_INSTANCE: The later-created instances are removed first.

Default Value

OLD_CONFIG_OLD_INSTANCE

delete_publicip

No

Boolean

Definition

Specifies whether to delete the EIPs bound to ECSs when the ECSs are removed from the AS group during scale-in actions.

Constraints

If an EIP is billed on a yearly/monthly basis, it will not be deleted when an ECS is removed.

Range

true or false

  • true: The EIPs bound to ECSs will be deleted when the ECSs are removed.
  • false: The EIPs bound to ECSs will be unbound but will not be deleted when the ECSs are removed.

Default Value

false

delete_volume

No

Boolean

Definition

Specifies whether to delete the data disks attached to ECSs when the ECSs are removed from the AS group during scale-in actions.

Constraints

If a data disk is billed on a yearly/monthly basis, it will not be deleted when an ECS is removed.

Range

true or false

  • true: The data disks attached to ECSs will be deleted when the ECSs are removed. If a data disk is billed on a yearly/monthly basis, it will not be deleted when an ECS is removed.
  • false: The data disks attached to the ECSs will be detached but will not be deleted when the ECSs are removed.

Default Value

false

enterprise_project_id

No

String

Definition

Specifies the enterprise project ID, which is used to specify the enterprise project to which the AS group belongs. For details about how to obtain an enterprise project ID, see Listing Enterprise Projects. For details about enterprise project features, see Enterprise Project Management Service.

Constraints

If an enterprise project is configured for an AS group, ECSs created in this AS group also belong to this enterprise project. Otherwise, the default enterprise project is used.

Range

  • If the value is 0 or left blank, the AS group belongs to the default enterprise project.
  • If the value is a UUID, the AS group belongs to the enterprise project corresponding to the UUID.

Default Value

N/A

multi_az_priority_policy

No

String

Definition

Specifies the priority policy for selecting the target AZ during a scaling action.

Constraints

N/A

Range

  • EQUILIBRIUM_DISTRIBUTE (default): During a scaling action, the system preferentially distributes instances evenly across AZs listed in available_zones. If it fails in the target AZ, it selects another AZ based on the PICK_FIRST policy.
  • PICK_FIRST: During a scaling action, target AZs are determined in the order in the available_zones list.

Default Value

EQUILIBRIUM_DISTRIBUTE

description

No

String

Definition

Specifies the description of the AS group.

Constraints

N/A

Range

1 to 256 characters, with no restrictions on character types

Default Value

N/A

iam_agency_name

No

String

Definition

Specifies the agency name. An agency is created by a tenant administrator in Identity and Access Management (IAM) to provide temporary credentials for the ECS service to access other cloud services.

Constraints

  • The iam_agency_name field is omitted if it is null or not provided.
  • Otherwise, it is passed downstream.

Range

1 to 64 characters, with no restrictions on character types

Default Value

N/A

tags

No

Array of tags objects

Definition

Creates tags and adds them to the AS group. Each AS group can have a maximum of 10 tags. For details, see Table 8.

Constraints

N/A

Table 3 lbaas_listeners field description

Parameter

Mandatory

Type

Description

pool_id

Yes

String

Definition

Specifies the backend server group ID. For details about how to obtain it, see Querying Backend Server Groups.

Constraints

N/A

Range

N/A

Default Value

N/A

protocol_port

Yes

Integer

Definition

Specifies the backend protocol port, which is the port listened on by backend ECSs.

Constraints

N/A

Range

[1, 65535]

Default Value

N/A

weight

Yes

Integer

Definition

Specifies the weight of a backend server. Requests are routed based on the load balancing algorithm configured for the backend server group and weights of backend servers. A larger weight value indicates more requests routed to a backend server. 0 indicates a backend server will not accept new requests.

Constraints

If lb_algorithm is set to SOURCE_IP or QUIC_CID, this field is invalid.

Range

[0, 100]

Default Value

N/A

protocol_version

No

String

Definition

Specifies the version of IP addresses used by the backend server group with load balancing configured.

Constraints

  • Instances in an AS group do not support IPv4/IPv6 dual-stack on multiple NICs. IPv4/IPv6 dual-stack is only available for the first NIC that supports both IPv4 and IPv6. The NIC may be a primary NIC or an extension NIC.
  • Only ECSs with flavors that support IPv6 addresses can use IPv4/IPv6 dual-stack networks. If you want to select IPv6 for this parameter, make sure that you have selected such ECS flavors in a supported region.
  • If IPv6 is selected, ensure that both ELB and VPC support IPv6.
  • If you add two or more load balancers whose pool_id, protocol_port, and protocol_version settings are totally the same, deduplication will be performed.

Range

ipv4 or ipv6

  • ipv4: IPv4 addresses are used.
  • ipv6: IPv6 addresses are used.

Default Value

ipv4

Table 4 networks field description

Parameter

Mandatory

Type

Description

id

Yes

String

Definition

Specifies the subnet ID. For details about how to obtain it, see Querying Subnets.

Constraints

N/A

Range

N/A

Default Value

N/A

ipv6_enable

No

Boolean

Definition

Whether IPv6 is enabled.

Constraints

The subnet must support IPv6.

Range

  • true: IPv6 is enabled for the NIC.
  • false: IPv6 is not enabled for the NIC.

Default Value

false

ipv6_bandwidth

No

ipv6_bandwidth object

Definition

Specifies the IPv6 shared bandwidth. This parameter is left blank by default, indicating that no shared IPv6 bandwidth is bound.

Constraints

N/A

allowed_address_pairs

No

Array of allowed_address_pairs objects

Definition

Specifies whether to enable source/destination check. For details, see Table 6.

Constraints

N/A

Table 5 ipv6_bandwidth field description

Parameter

Mandatory

Type

Description

id

Yes

String

Definition

Specifies the ID of the IPv6 shared bandwidth. For details about how to obtain it, see Querying Shared Bandwidth Types of a Specified Tenant.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 6 allowed_address_pairs field description

Parameter

Mandatory

Type

Description

ip_address

No

String

Definition

Specifies whether to enable source/destination check for IP addresses.

Constraints

N/A

Range

  • To disable this function, set the value to 1.1.1.1/0.
  • To enable this function, set a value other than 1.1.1.1/0.

Default Value

This function is enabled by default. This parameter cannot be left blank.

Table 7 security_groups field description

Parameter

Mandatory

Type

Description

id

Yes

String

Definition

Specifies the security group ID. For details about how to obtain it, see Querying Security Groups.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 8 tags field description

Parameter

Mandatory

Type

Description

key

Yes

String

Definition

Specifies the tag key.

Constraints

  • The key cannot be left blank.
  • Keys must be unique within the same resource.

Range

  • A key can contain up to 36 Unicode characters.
  • The key of the tag can contain only uppercase letters, lowercase letters, digits, underscores (_), and hyphens (-).

Default Value

N/A

value

No

String

Definition

Specifies the tag value.

Constraints

N/A

Range

  • A value can contain up to 43 Unicode characters and can be an empty string.
  • The value can contain only uppercase letters, lowercase letters, digits, underscores (_), hyphens (-), and periods (.).

Default Value

N/A

Example Request

This example creates an AS group with the name GroupNameTest, the AS configuration ID 47683a91-93ee-462a-a7d7-484c006f4440, the VPC ID a8327883-6b07-4497-9c61-68d03ee193a, the NIC ID 3cd35bca-5a10-416f-8994-f79169559870, the maximum number of instances of 10, the expected number of instances of 0, the minimum number of instances of 0, the health check method of ECS health check, and the multi-AZ scaling policy of PICK_FIRST. The enterprise project is specified by you.

POST https://{Endpoint}/autoscaling-api/v1/{project_id}/scaling_group

{
    "scaling_group_name": "GroupNameTest",
    "scaling_configuration_id": "47683a91-93ee-462a-a7d7-484c006f4440",
    "desire_instance_number": 0,
    "min_instance_number": 0,
    "max_instance_number": 10,
    "health_periodic_audit_method": "NOVA_AUDIT",
    "vpc_id": "a8327883-6b07-4497-9c61-68d03ee193a",
    "available_zones": ["XXXa","XXXb"],
    "networks": [
        {
            "id": "3cd35bca-5a10-416f-8994-f79169559870"
        }
    ],
    "enterprise_project_id":"c92b1a5d-6f20-43f2-b1b7-7ce35e58e413",
    "multi_az_priority_policy":"PICK_FIRST",
    "iam_agency_name":"test",
    "tags":[{"key":"1"}]
}

Response

Table 9 Response parameters

Parameter

Type

Description

scaling_group_id

String

Definition

Specifies the AS group ID.

Range

N/A

Example Response

{
    "scaling_group_id": "a8327883-6b07-4497-9c61-68d03ee193a1"
}

Returned Values

  • Normal

    200

  • Abnormal

    Returned Value

    Description

    400 Bad Request

    The server failed to process the request.

    401 Unauthorized

    You must enter the username and password to access the requested page.

    403 Forbidden

    You are forbidden to access the requested page.

    404 Not Found

    The server could not find the requested page.

    405 Method Not Allowed

    You are not allowed to use the method specified in the request.

    406 Not Acceptable

    The response generated by the server could not be accepted by the client.

    407 Proxy Authentication Required

    You must use the proxy server for authentication to process the request.

    408 Request Timeout

    The request timed out.

    409 Conflict

    The request could not be processed due to a conflict.

    500 Internal Server Error

    Failed to complete the request because of an internal service error.

    501 Not Implemented

    Failed to complete the request because the server does not support the requested function.

    502 Bad Gateway

    Failed to complete the request because the request is invalid.

    503 Service Unavailable

    Failed to complete the request because the system is unavailable.

    504 Gateway Timeout

    A gateway timeout error occurred.

Error Codes

See Error Codes.