Improve scale-out success with multiple instance types

更新时间:
复制 MD 格式

To improve the success rate of scale-out events, you can configure a scaling group with multiple instance types by using the Extend Launch Template feature. This topic shows you how to specify multiple instance types for a scaling group that uses a launch template.

Background

A launch template contains the configuration information for an Elastic Compute Service (ECS) instance and is used to quickly create instances. Using a launch template helps you avoid repeating configurations and simplifies the instance creation process. For more information, see Overview of instance launch templates.

When you configure a scaling group for ECS instances, you can select a launch template as the instance configuration source. During a scale-out event, Auto Scaling uses the configuration from the launch template to create new ECS instances. By default, a launch template can specify only a single instance type. If that specific instance type has insufficient inventory, the scale-out event fails. To increase the scale-out success rate, use the Extend Launch Template feature. This feature lets you specify multiple instance types to override the single instance type in the launch template. If one instance type is unavailable due to insufficient inventory, Auto Scaling automatically tries another type from your priority list, preventing scale-out failures and ensuring business continuity.

Prerequisites

Before you create or configure a scaling group, go to the Launch Templates page in the ECS console to create a launch template, or use an existing one. For information about how to create a launch template, see Create an instance launch template.

Important

Auto Scaling supports launch templates that use the pay-as-you-go or Preemptible Instance billing method. Launch templates that use the subscription billing method are not supported. If you use a launch template with the subscription billing method, Auto Scaling automatically converts it to use the pay-as-you-go billing method.

This topic uses the following launch template as an example:

  • Billing method: pay-as-you-go

  • Instance type: ecs.g5.large

Other configurations for this launch template include: the region is China (Beijing), the image is Alibaba Cloud Linux 3.2104 LTS 64-bit, storage is a 40 GiB PL0 ESSD system disk that is released with the instance, and the network type is VPC.

Procedure

This procedure demonstrates the benefits of a launch template with multiple instance types by guiding you through the creation of two scaling groups.

  • Scaling group A: Uses only a launch template without the Extend Launch Template feature.

  • Scaling group B: Uses a launch template with the Extend Launch Template feature to configure multiple instance types.

  1. Log on to the Auto Scaling console.

  2. Create scaling group A.

    1. On the Scaling Groups page, click Create.

    2. Configure the scaling group, and then click Create.

      This topic uses the following parameters as an example. You can keep the default values for other parameters. For more information, see Create a scaling group.

      Parameter

      Example

      Description

      Scaling Group Name

      test-a

      Enter a name for the scaling group. For format requirements, refer to the on-screen instructions.

      Type

      ECS

      Select ECS to specify that the scaling group manages ECS instances.

      Instance Configuration Source

      Launch Template

      Select Template Name. During scale-out events, the scaling group will use the specified launch template to create ECS instances.

      Select Launch Template

      test

      Select the launch template that you prepared.

      Select Template Version

      Latest Version

      Select the version of the launch template that you want to use.

      Minimum Number of Instances

      1

      The minimum number of instances in the scaling group. If the current number of instances falls below this limit, Auto Scaling automatically adds instances until the limit is met.

      Maximum Number of Instances

      1

      The maximum number of instances in the scaling group. If the current number of instances exceeds this limit, Auto Scaling automatically removes instances until the limit is met.

  3. Create scaling group B.

    Repeat the steps for creating scaling group A to create scaling group B (named test-b). In addition to the parameters configured for scaling group A, configure the Extend Launch Template feature for scaling group B by following these steps:

    1. In the Extend Launch Template section, select Override Instance Type in Launch Template.

    2. Decide whether to use the number of vCPUs to calculate the scaling group capacity.

      If you select Use vCPUs to calculate the capacity of the scaling group, you can view the Weight value for each selected instance type in the Selected Instance Types section. Setting a vCPU capacity recalculates the current capacity of the scaling group, which may trigger a new scaling event. You can also use other performance metrics associated with instance types, such as memory size, to customize how Auto Scaling measures your scaling group's capacity. For more information, see Use performance metrics as the unit of measurement for Auto Scaling.

    3. In the Available Instance Types section, click the icon icon next to the instance types that you want to select.

      The instance type from the launch template is added to the Selected Instance Types list by default. You can select multiple instance types by using the Select All Instance Types, Recommended by Instance Type, or Recommended by vCPU options.

      In this example, we add ecs.g5ne.large and ecs.g6.large. We recommend selecting additional instance types to reduce the risk of stockouts.

    4. In the Selected Instance Types section, adjust the priority order of the instance types.

  4. Enable scaling group A and scaling group B to trigger a scale-out event.

    You can trigger a scale-out action for a scaling group by setting the minimum number of instances, setting the expected number of instances, or executing a scaling rule.

    Because the minimum number of instances is 1 for both scaling groups, enabling them automatically creates one ECS instance in each group.

Results comparison

Click the ID of each scaling group to open its details page. On the Instances tab, view the ECS instance information to compare the instance types.

  • Scaling group A: Uses only a launch template.

    Because the launch template specifies ecs.g5.large, the created ECS instance is of type ecs.g5.large. If the ecs.g5.large instance type has insufficient inventory, the scale-out will fail.

  • Scaling group B: Uses a launch template with multiple instance types.

    In addition to the ecs.g5.large specified in the launch template, ecs.g5ne.large and ecs.g6.large are also added. Because ecs.g6.large has the highest priority in this example, the created ECS instance is of type ecs.g6.large. If ecs.g6.large is out of stock, Auto Scaling will attempt to create ecs.g5.large and then ecs.g5ne.large instances, according to their priority.

Using multiple instance types makes your scaling group more resilient than using a single type. If one instance type has insufficient inventory, Auto Scaling automatically attempts to create an instance from the next available type in your priority list. This method significantly increases the scale-out success rate and ensures your application can scale with demand.