Create a scaling group

Last Updated: Sep 27, 2017

A scaling group is a collection of ECS instances with the same application scenarios.

It defines the max and min numbers of ECS instances in the group, as well as their associated Server Load Balancer instances, RDS instances, and other attributes.

Description

This operation creates a scaling group according to input parameters.

  • MaxSize and MinSize respectively define the maximum and minimum number of ECS instances in a scaling group.

    • When the current number (total capacity) of ECS instances in the scaling group is smaller than MinSize, the Auto Scaling service automatically attaches ECS instances to the scaling group to make odds even.
    • When the current number (total capacity) of ECS instances in the scaling group is greater than MaxSize, the Auto Scaling service automatically removes ECS instances from the scaling group to make odds even.
  • Default Cooldown indicates the default cool-down time of the scaling group.

    • During the cool-down time after a scaling activity (adding or removing ECS instances) is executed, the scaling group cannot execute any other scaling activity.
    • Currently, this only applies to scaling activities triggered by CloudMonitor’s alarm tasks.
  • Removal Policy is used to select the ECS instances you want to remove from the scaling group when multiple candidates for removal exist.

    • If a Server Load Balancer instance is specified in the scaling group, the scaling group automatically attaches its ECS instances to the Server Load Balancer instance.
    • The Server Load Balancer instance must be enabled.
    • Health check must be enabled for all listener ports configured for the Server Load Balancer instance; otherwise, creation fails.
    • The Server Load Balancer instance attached with VPC-type ECS instances cannot be attached to the scaling group.
    • The default weight of an ECS instance attached to the Server Load Balancer instance is 50.
  • If an RDS instance is specified in the scaling group, the scaling group automatically attaches the Intranet IP addresses of its ECS instances to the RDS access whitelist.

    • The specified RDS instance must be in running status.
    • The specified RDS instance’s whitelist must have room for more IP addresses.
  • The scaling group does not take effect immediately after creation. It must be enabled to support scaling rule trigger and execute scaling activities.

  • For details about how to remove ECS instances from the scaling group, refer to the Removal policies section.

  • The scaling group, Server Load Balancer instance, and RDS instance must be in the same region.

  • You can create up to 20 scaling groups.

Request parameters

Name Type Required Description
Action String Yes Operation interface name, required parameter. Value:
CreateScalingGroup
RegionId String Yes ID of the region where a scaling group is located.
MaxSize Integer Yes Maximum number of ECS instances in the scaling group. Value range: [0, 100].
MinSize Integer Yes Minimum number of ECS instances in the scaling group. Value range: [0, 100].
ScalingGroupName String No Name shown for the scaling group, which must contain 2-40 characters (English or Chinese). The name must begin with a number, an upper/lower-case letter or a Chinese character and may contain numbers, “_”, “-“ or “.”. The account name is unique in the same region.
If this parameter is not specified, the default value is ScalingGroupId.
DefaultCooldown Integer No Default cool-down time (in seconds) of the scaling group. Value range: [0, 86400].
The default value is 300s.
RemovalPolicy.N String No Policy for removing ECS instances from the scaling group.
Optional values:
- OldestInstance: removes the first ECS instance attached to the scaling group.
- NewestInstance: removes the first ECS instance attached to the scaling group.
- OldestScalingConfiguration: removes the ECS instance with the oldest scaling configuration.
Default values: OldestScalingConfiguration and OldestInstance. You can enter up to two removal policies.
LoadBalancerIds String No ID list of a Server Load Balancer instance. A Json Array with format:[ “lb-id0”, “lb-id1”, … “lb-idz” ],support up to 5 Load Balancer instance.
DBInstanceIds String No ID list of an RDS instance. A Json Array with format:[ “rm-id0”, “rm-id1”, … “rm-idz” ],support up to 8 RDS instance.

Return parameters

Name Type Description
ScalingGroupId String ID of a scaling group, generated by the system and globally unique.

Error code

For errors common to all interfaces, refer to the Client Error Table or Server Error Table.

Error Error code Description HTTP status code
The scaling group name already exists. InvalidScalingGroupName.Duplicate The specified value of parameter <parameter name> is duplicated. 400
The scaling group quota is exceeded. QuotaExceeded.ScalingGroup Scaling group quota exceeded. 400
The specified region does not exist. InvalidRegionId.NotFound The specified region does not exist. 404
The specified MinSize is greater than MaxSize. InvalidParameter.Conflict The value of parameter <parameter name> and parameter <parameter name> are conflict. 400
The specified Server Load Balancer instance does not exist in this account. InvalidScalingGroupId.NotFound The specified scaling group does not exist. 404
The specified Server Load Balancer instance and scaling group are not in the same region. InvalidLoadBalancerId.RegionMismatch The specified Load Balancer and the specified scaling group are not in the same Region. 400
The specified Server Load Balancer instance is not active. IncorrectLoadBalancerStatus The current status of the specified load balancer does not support this action. 400
Health check is not enabled for the specified Server Load Balancer instance. IncorrectLoadBalancerHealthCheck The current health check type of specified load balancer does not support this action. 400
The specified Server Load Balancer instance becomes private after the VswitchID is specified. InvalidLoadBalancerId.IncorrectAddressType The current address type of specified load balancer does not support this action. 400
The network type of the ECS instance contained in the specified Server Load Balancer is different from the network type of the scaling group. InvalidLoadBalancerId.IncorrectInstanceNetworkType The network type of the instance in specified Load Balancer does not support this action. 400
The ECS instance contained in the specified Server Load Balancer and VSwitchId are not in the same VPC. InvalidLoadBalancerId.VPCMismatch The specified VSwitch and the instance in specified Load Balancer are not in the same VPC. 400
The specified RDS instance does not exist in this account. InvalidDBInstanceId.NotFound DB instance “XXX” does not exist. 404
The specified RDS instance and scaling group are not in the same region. InvalidDBInstanceId. RegionMismatch DB instance “XXX” and the specified scaling group are not in the same Region. 400
The specified RDS instance is not running. IncorrectDBInstanceStatus The current status of DB instance “XXX” does not support this action. 400
The number of IP addresses in the access whitelist of the specified RDS instance exceeds the upper limit. QuotaExceeded.DBInstanceSecurityIP Security IP quota exceeded in DB instance “XXX”. 400
The specified VSwitch does not exist. InvalidVSwitchId.NotFound The specified VSwitch does not exist. 404
The private IP address quota of the VSwitch is exceeded. QuotaExceeded.PrivateIpAddress Private IP address quota exceeded in the specified VSwitch. 400
The instance quota of the VPC is exceeded. QuotaExceeded.VPCInstance Instance quota exceeded in the specified VPC. 400
The VSwitch is unavailable and instances cannot be created. IncorrectVSwitchStatus The current status of VSwitch does not support this operation. 400

Example

Request example
  1. http://ess.aliyuncs.com/?Action=CreateScalingGroup
  2. &RegionId=cn-qingdao
  3. &MaxSize=20
  4. &MinSize=2
  5. &LoadBalancerId=147b46d767c-cn-qingdao-cm5-a01
  6. &DBInstanceId.1=rdszzzyyunybaeu
  7. &DBInstanceId.2=rdsia3u3yia3u3y
  8. &<Public Request Parameters>
Return example

XML format:

  1. <CreateScalingGroupResponse>
  2. <ScalingGroupId>dP8VqSd9ENXPc0ciVmbcrBT1</ScalingGroupId>
  3. <RequestId>536E9CAD-DB30-4647-AC87-AA5CC38C5382</RequestId>
  4. </CreateScalingGroupResponse>

JSON format:

  1. {
  2. "RequestId": "536E9CAD-DB30-4647-AC87-AA5CC38C5382",
  3. "ScalingGroupId": "dP8VqSd9ENXPc0ciVmbcrBT1"
  4. }
Thank you! We've received your feedback.