All Products
Search
Document Center

Auto Scaling:Overview

Last Updated:Oct 13, 2023

A scaling group is a group of Elastic Compute Service (ECS) instances or elastic container instances that can be used for similar business scenarios. If you have multiple business scenarios, you can create multiple scaling groups. Auto Scaling automatically adjusts the number of instances in the scaling groups based on your configurations.

Feature comparison of different types of scaling groups

If you set the Type parameter to ECS when you create a scaling group, the scaling group contains ECS instances. If you set the Type parameter to ECI when you create a scaling group, the scaling group contains elastic container instances. Different types of scaling groups provide different features. The following table describes the features of scaling groups that contain ECS instances and scaling groups that contain elastic container instances.

Note

You can manually add or remove non-Alibaba Cloud instances to or from scaling groups of the ECS type. However, you cannot use scaling groups to manage the lifecycles of non-Alibaba Cloud instances. After you remove non-Alibaba Cloud instances from scaling groups, the instances are not released. For more information, see Manually add managed instances to a scaling group.

Category

Feature

ECS

ECI

User guide

API references

Scaling group

Basic configurations

Supported

Supported

Manage scaling groups

CreateScalingGroup

Deletion protection

Supported

Supported

N/A

SetGroupDeletionProtection

Health check

Supported

Supported

Health checks on instances in a scaling group

Association with Server Load Balancer (SLB) instances

Supported

Supported

Associate SLB instances with or disassociate SLB instances from a scaling group

Association with ApsaraDB RDS instances

Supported

Supported

Associate ApsaraDB RDS instances with a scaling group or disassociate ApsaraDB RDS instances from a scaling group

Instance configuration source

Launch template

Supported

Unsupported

Overview

CreateLaunchTemplate

Scaling configuration

Supported

Supported

Image update

Supported

Unsupported

N/A

Instance list

Automatic creation of instances

Supported

Supported

Manual addition of instances

Supported

Supported

Manually add ECS instances or elastic container instances to a scaling group

AttachInstances

Management of non-Alibaba Cloud instances

Supported

Unsupported

Manually add managed instances to a scaling group

AttachInstances

Monitoring

Supported

Supported

N/A

Scaling rule and event-triggered task

Scaling rule

Supported

Supported

Manage scaling rules

CreateScalingRule

Scheduled task

Supported

Supported

Create a scheduled task

CreateScheduledTask

Event-triggered task

Supported

Supported

Manage event-triggered tasks

CreateAlarm

Scaling activity

Supported

Supported

Overview

N/A

Lifecycle hook

Supported

Supported

Manage lifecycle hooks

CreateLifecycleHook

Notification rule

Supported

Supported

Create an advanced notification rule

CreateNotificationConfiguration

Rolling update

Supported

Supported

Rolling update

N/A

Health diagnosis

Supported

Supported

Health diagnosis

N/A

Scaling group status

The following table describes the possible states of a scaling group.

State

API state

Description

User guide

API references

Creating/Created

Inactive

  • When you create a scaling group, the scaling group remains in the Creating state until you complete the required configurations.

  • After you complete the required configurations, the scaling group enters the Created state. Scaling groups that are in the Created state are not displayed on the Scaling Groups page.

Enabling

Inactive

When you enable a scaling group that is in the Disabled state, the scaling group enters the Enabling state.

Enable a scaling group

EnableScalingGroup

Enabled

Active

After you enable a scaling group, the scaling group enters the Enabled state. You can modify scaling groups that are in the Enabled state.

Disabling/Disabled

Inactive

  • After you create a scaling group, the scaling group remains in the Disabled state until you enable the scaling group. Scaling groups in the Disabling or Disabled state are displayed on the Scaling Groups page.

  • After you disable a scaling group that is in the Enabled state, the scaling group enters the Disabled state.

Disable a scaling group

DisableScalingGroup

Deleting

Deleting

If you delete a scaling group, the scaling group enters the Deleting state.

Delete a scaling group

DeleteScalingGroup

Instance configuration source

When you create a scaling group, you must specify an instance configuration source. You can specify Launch Templates, Select Existing Instance, or Create from Scratch as the instance configuration source. Before you specify Select Existing Instance, make sure that a scaling configuration is created. If you specify Create from Scratch, you must create a scaling configuration after you create a scaling group. The following table describes the three types of instance configuration sources.

Instance configuration source

Applicable scope

Difference

Launch Templates

The Launch Templates setting takes effect only for scaling groups that contain ECS instances. If your scaling group contains elastic container instances, you cannot set the Instance Configuration Source parameter to Launch Templates.

  • After you create a scaling group whose instance configuration source is a launch template, you can immediately enable the scaling group.

  • If you want to modify the configurations of instances in a scaling group, you can modify the default launch template that is used by the scaling group or update the launch template to the latest version. You cannot specify multiple instance types in the launch template.

    Note

    If the billing method of the launch template is subscription, Auto Scaling changes subscription to pay-as-you-go.

Select Existing Instance

The Select Existing Instance setting takes effect for scaling groups that contain ECS instances and scaling groups that contain elastic container instances.

  • After you create a scaling group whose instance configuration source is an existing instance, you can immediately enable the scaling group.

  • Auto Scaling creates a scaling configuration based on the existing instance that you select. The scaling configuration serves as the template that is used to create ECS instances or elastic container instances. The selected instance provides the following information that Auto Scaling can use to create a scaling configuration: region, zones, images, disks, network settings, and security groups.

  • The scaling configuration that is created by Auto Scaling uses the base image data based on which the selected instance is created.

Create from Scratch

The Create from Scratch setting takes effect for scaling groups that contain ECS instances and scaling groups that contain elastic container instances.

After you create a scaling group, you must create a scaling configuration or a launch template to enable the scaling group. Then, you can use the scaling configuration or the launch template to create ECS instances or elastic container instances in the scaling group.

A scaling group can contain only one active scaling configuration source. For example, if you activate a new scaling configuration in a scaling group for which an active scaling configuration or launch template is already specified, the current launch template or scaling configuration exits the Active state. For more information, see Overview.

Scaling rules and activities

After you create a scaling group, you must create scaling rules to add instances to or remove instances from the scaling group.

Scaling rules

You can create scaling rules to trigger scaling activities in a scaling group or readjust the maximum and minimum numbers of instances in the scaling group. For more information, see Overview.

  • Feature: Auto Scaling calculates and scales the required number of ECS instances or elastic container instances in a scaling group based on its scaling rules and maximum, minimum, or expected number of instances.

    For example, if you create a scaling rule that adjusts the number of instances in your scaling group to 50 and the maximum number of ECS instances that are allowed in your scaling group is 45, your scaling group contains only 45 ECS instances after the scaling rule is executed.

    Note

    For more information about the Expected Number of Instances feature, see Expected number of instances.

  • Execution methods: You can use one of the following methods to execute a scaling rule:

Scaling activities

A scaling activity is triggered when a scaling rule is executed or when you manually add or remove ECS instances or elastic container instances. For more information, see Overview.

  • Usage notes

    • You cannot terminate an ongoing scaling activity. For example, if a scaling activity is being executed to create 20 ECS instances and only five instances have been created, you cannot terminate the scaling activity.

    • If several ECS instances fail to be added to a scaling group during a scaling activity, Auto Scaling considers the scaling activity complete. Auto Scaling rolls back only the ECS instances that fail to be added to the scaling group. For example, if a scaling group contains 20 ECS instances and 19 instances are added as backend servers of the SLB instance that is associated with the scaling group, only the ECS instance that fails to be added is rolled back and automatically released.

    • Auto Scaling uses Resource Access Management (RAM) to call ECS API operations to create ECS instances. After ECS instances are rolled back, you are still charged for the ECS instances until the ECS instances are released.

    • Scaling activities are affected by the cooldown periods of scaling groups. During a cooldown period, Auto Scaling rejects all scaling activities that are triggered by event-triggered tasks. When you manually execute a scaling rule or Auto Scaling executes a scheduled task at a specified point in time, a scaling activity can be triggered even before the cooldown period ends.

      Note

      A cooldown period starts after the last ECS instance or elastic container instance is added to or removed from a scaling group during a scaling activity. For more information about the cooldown period feature, see Cooldown period.

  • Remarks

    If your scaling group is associated with SLB instances or ApsaraDB RDS instances, take note of the following items when scaling activities are triggered in the scaling group:

    Item

    Description

    Your scaling group is associated with SLB instances or server groups.

    • If an associated SLB instance or server group is deleted or does not exist, scaling activities in the scaling group fail.

    • Auto Scaling regularly checks whether the scaling group has associated SLB instances or server groups. If Auto Scaling detects that an associated SLB instance or server group is deleted or does not exist, Auto Scaling disassociates the SLB instance or the server group from the scaling group.

      Important

      In this case, the disassociated SLB instance or server group cannot cause scaling failures in the scaling group.

    Your scaling group is associated with ApsaraDB RDS instances.

    • If an associated ApsaraDB RDS instance is deleted or does not exist, scaling activities in the scaling group fail.

    • Auto Scaling regularly checks whether the scaling group has associated ApsaraDB RDS instances. If Auto Scaling detects that an associated ApsaraDB RDS instance is deleted or does not exist, Auto Scaling disassociates the ApsaraDB RDS instance from the scaling group.

      Important

      In this case, the disassociated ApsaraDB RDS instance cannot cause scaling failures in the scaling group.