An AS group consists of a collection of instances that apply to 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 balancing.
POST /autoscaling-api/v1/{project_id}/scaling_group
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Specifies the project ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
scaling_group_name |
Yes |
String |
Specifies the AS group name. The name contains only letters, digits, underscores (_), and hyphens (-), and cannot exceed 64 characters. |
scaling_configuration_id |
Yes |
String |
Specifies the AS configuration ID, which can be obtained using the API for querying AS configurations. For details, see Querying AS configurations. |
desire_instance_number |
No |
Integer |
Specifies the expected number of instances. The default value is the minimum number of instances. The value ranges from the minimum number of instances to the maximum number of instances. |
min_instance_number |
No |
Integer |
Specifies the minimum number of instances. The default value is 0. |
max_instance_number |
No |
Integer |
Specifies the maximum number of instances. The default value is 0. |
cool_down_time |
No |
Integer |
Specifies the cooldown period (in seconds). The value ranges from 0 to 86400 and is 300 by default. After a scaling action is triggered, the system starts the cooldown period. During the cooldown period, scaling actions triggered by alarms will be denied. Scheduled, periodic, and manual scaling actions are not affected. |
lb_listener_id |
No |
String |
Specifies the ID of a classic load balancer listener. You can add up to six load balancer listeners. Separate listener IDs with commas (,). This parameter is alternative to lbaas_listeners. |
lbaas_listeners |
No |
Array of lbaas_listeners objects |
Specifies information about an enhanced load balancer. You can add up to six load balancers. This parameter is in list data structure. For details, see Table 3. This parameter is alternative to lb_listener_id. |
available_zones |
No |
Array of strings |
Specifies the AZ information. The instances 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. |
networks |
Yes |
Array of networks objects |
Specifies network information. You can select up to five subnets. The first subnet you select is used by the primary NICs of ECSs by default. For the information about the data structure, see Table 4. |
security_groups |
No |
Array of security_groups objects |
Specifies the security group. A maximum of one security group can be selected. For the information about the data structure, see Table 5. If the security group is specified both in the AS configuration and AS group, scaled ECS instances will be added to the security group specified in the AS configuration. If the security group is not specified in either of them, scaled ECS instances will be added to the default security group. For your convenience, you are advised to specify the security group in the AS configuration. |
vpc_id |
Yes |
String |
Specifies the VPC ID, which can be obtained using the API for querying VPCs. For details, see "Querying VPCs" in Virtual Private Network API Reference. |
health_periodic_audit_method |
No |
String |
Specifies the health check method for instances in the AS group. The health check methods include ELB_AUDIT and NOVA_AUDIT. When load balancing is configured for an AS group, the default value is ELB_AUDIT. Otherwise, the default value is NOVA_AUDIT.
|
health_periodic_audit_time |
No |
Integer |
Specifies the instance health check period. The value can be 1, 5, 15, 60, or 180 in the unit of minutes. If this parameter is not specified, the default value is 5. If the value is set to 0, health check is performed every 10 seconds. |
health_periodic_audit_grace_period |
No |
Integer |
Specifies the grace period for instance health check. The unit is second and the value ranges from 0 to 86400. The default value is 600. 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 status only after the grace period ends. This parameter is valid only when the instance health check method of the AS group is ELB_AUDIT. |
instance_terminate_policy |
No |
String |
Specifies the instance removal policy.
|
notifications |
No |
Array of strings |
Specifies the notification mode. EMAIL refers to notification by email. |
delete_publicip |
No |
Boolean |
Specifies whether to delete the EIP bound to the ECS when deleting the ECS. The value can be true or false. The default value is false.
|
delete_volume |
No |
Boolean |
Specifies whether to delete the data disks attached to the ECS when deleting the ECS. The value can be true or false. The default value is false.
|
enterprise_project_id |
No |
String |
Specifies the enterprise project ID, which is used to specify the enterprise project to which the AS group belongs.
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 will be used. |
multi_az_priority_policy |
No |
String |
Specifies the priority policy used to select target AZs when adjusting the number of instances in an AS group.
|
description |
No |
String |
Specifies the description of the AS group. The value can contain 1 to 256 characters. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
pool_id |
Yes |
String |
Specifies the backend ECS group ID. |
protocol_port |
Yes |
Integer |
Specifies the backend protocol ID, which is the port on which a backend ECS listens for traffic. The port ID ranges from 1 to 65535. |
weight |
Yes |
Integer |
Specifies the weight, which determines the portion of requests a backend ECS processes when being compared to other backend ECSs added to the same listener. The value of this parameter ranges from 0 to 100. |
The following example shows how to create an AS group:
The request example is as follows:
{ "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", }
Parameter |
Type |
Description |
---|---|---|
scaling_group_id |
String |
Specifies the AS group ID. |
{ "scaling_group_id": "a8327883-6b07-4497-9c61-68d03ee193a1" }
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. |
See Error Codes.