Help Center > Auto Scaling > API Reference > AS Groups > Creating an AS Group

Creating an AS Group

Function

This interface is used to create an AS group. An AS group is a set of ECS instances with the same application scenario configurations. An AS group defines the minimum and maximum numbers of ECS instances.

URI

  • URI format

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

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    tenant_id

    Yes

    String

    Specifies the tenant ID.

Request

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    scaling_group_name

    Yes

    String

    Specifies the AS group name. The name can contain letters, digits, underscores (_), and hyphens (-), and cannot exceed 64 characters.

    scaling_configuration_id

    No

    String

    Specifies the AS configuration ID. You can obtain its value from the API used to query 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 cooling duration (in seconds). The value ranges from 0 to 86400, and is 900 by default.

    The cooling duration takes effect only for scaling actions triggered by alarms. Scaling actions executed manually as well as those scheduled to trigger periodically or at a particular time will not be affected.

    lb_listener_id

    No

    String

    Specifies the ELB listener ID. The system supports the binding of up to three ELB listeners, the IDs of which are separated using a comma (,). You can use vpc_id to obtain a load balancer ID from the API used to query an ELB list. For details, see section "Querying Load Balancers" in the Elastic Load Balance API Reference. Then, use the load balancer ID to query the ELB listener list to obtain the ELB listener ID. For details, see section "Querying Listeners" in the Elastic Load Balance API Reference.

    available_zones

    No

    List<String>

    Specifies the AZ information. The ECS associated with the scaling action will be created in the specified AZ. If you do not specify an AZ, the system automatically specifies one.

    For details, see section Regions and Endpoints.

    networks

    Yes

    List data structure

    Specifies network information. The system supports up to five subnets. The first subnet transferred serves as the primary NIC of the ECS by default. You can use vpc_id to obtain the parameter value from the API used to query VPC subnets. For details, see section "Querying Subnets" in the Virtual Private Cloud API Reference.

    security_groups

    Yes

    List data structure

    Specifies security group information. You can use vpc_id to obtain the parameter value from the API used to query VPC security groups. For details, see section "Querying Security Groups" in the Virtual Private Cloud API Reference.

    vpc_id

    Yes

    String

    Specifies the VPC information. You can obtain its value from the API used to query VPCs. For details, see section "Querying VPCs" in the Virtual Private Cloud 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. If load balancing is configured, the default value of this parameter is ELB_AUDIT. Otherwise, the default value is NOVA_AUDIT.

    • ELB_AUDIT refers to the ELB health check, which takes effect in an AS group that has a listener.
    • NOVA_AUDIT refers to the health check delivered with AS.

    health_periodic_audit_time

    No

    Integer

    Specifies the health check period for instances. The period has four options: 5 minutes (default), 15 minutes, 60 minutes, and 180 minutes.

    instance_terminate_policy

    No

    String

    Specifies the instance removal policy.

    • (Default) OLD_CONFIG_OLD_INSTANCE: The earlier-created instances that were selected from the instances created based on earlier-created configurations are removed first.
    • OLD_CONFIG_NEW_INSTANCE: The later-created instances that were selected from the instances created based on earlier-created configurations are removed first.
    • OLD_INSTANCE: The earlier-created instances are removed first.
    • NEW_INSTANCE: The later-created instances are removed first.

    notifications

    No

    List<String>

    Specifies the notification mode.

    EMAIL refers to notification by email.

    This notification mode is going to be canceled. You are advised to configure the notification function for the AS group. See Notifications for details.

    delete_publicip

    No

    Boolean

    Specifies whether to delete the EIP bound to the ECS when deleting the ECS. If you do not want to delete the EIP, set this parameter to false. Then, the system only unbinds the EIP from the ECS and reserves the EIP.

    The value can be true or false. The default value is false.

    • true: deletes the EIP bound to the ECS when deleting the ECS. When the ECS is charged in Yearly/Monthly mode, the EIP bound to the ECS will not be deleted when the ECS is deleted.
    • false: only unbinds the EIP bound to the ECS when deleting the ECS.
  • networks field data structure description

    Parameter

    Mandatory

    Type

    Description

    id

    Yes

    String

    Specifies the network ID.

  • security_groups field data structure description

    Parameter

    Mandatory

    Type

    Description

    id

    Yes

    String

    Specifies the ID of the security group.

  • Example request
{
    "scaling_group_name": "GroupNameTest",
    "scaling_configuration_id": "47683a91-93ee-462a-a7d7-484c006f4440",
    "desire_instance_number": 0,
    "min_instance_number": 0,
    "max_instance_number": 0,
    "cool_down_time": 200,
    "health_periodic_audit_method": "NOVA_AUDIT",
    "health_periodic_audit_time": "5",
    "instance_terminate_policy": "OLD_CONFIG_OLD_INSTANCE",
    "vpc_id": "a8327883-6b07-4497-9c61-68d03ee193a",
    "networks": [
        {
            "id": "3cd35bca-5a10-416f-8994-f79169559870"
        }
    ],
    "notifications": [
        "EMAIL"
    ],
    "security_groups": [
        {
            "id": "23b7b999-0a30-4b48-ae8f-ee201a88a6ab"
        }
    ]
}

Response

  • Parameter description

    Parameter

    Type

    Description

    scaling_group_id

    String

    Specifies the AS group ID.

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

Returned Value

  • 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 so that the request can be processed.

    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.

Registration