All Products
Search
Document Center

Auto Scaling:Configure instance numbers by using scheduled tasks

Last Updated:Nov 17, 2023

This topic describes how to create a scheduled task to configure the maximum number, minimum number, and expected number of instances in a scaling group.

Background information

You can use the following methods to configure or modify the instance numbers in a scaling group. The instance numbers include the maximum number of instances, the minimum number of instances, and the expected number of instances. This topic describes how to use a scheduled task (Method 2) to configure the instance numbers.

  • Method 1: When you create a scaling group, you can configure the instance numbers. After you create a scaling group, you can also modify the instance numbers. For more information, see Manage scaling groups.

  • Method 2: When you create a scheduled task, you can configure the instance numbers. After you create a scheduled task, you can also modify the instance numbers.

The number of instances in a scaling group after a scheduled task is executed varies based on the instance numbers that you configured when you created the scheduled task. The following rules take effect:

  • If you do not use a scheduled task to configure the instance numbers for a scaling group, Auto Scaling maintains the current instance numbers of the scaling group.

  • If you use a scheduled task to configure the instance numbers for a scaling group, Auto Scaling uses the instance numbers configured in the scheduled task to override the instance numbers of the scaling group. When you configure the instance numbers, take note of the following requirements:

    • The minimum number of instances must be smaller than or equal to the maximum number of instances.

    • The minimum number of instances must be smaller than or equal to the expected number of instances.

    • The expected number of instances must be smaller than or equal to the maximum number of instances.

    If the preceding requirements are not met, scaling activities will fail.

    • Example 1: A scaling activity fails because the minimum number of instances is larger than the maximum number of instances.

      In this example, the maximum number of instances is 2, and the minimum number of instances is 0. When you create a scheduled task for the scaling group, you set the minimum number of instances to 3. In this case, when the scheduled task triggers a scaling activity, Auto Scaling attempts to update the minimum number of instances from 0 to 3. However, the scaling activity fails because the minimum number of instances is larger than the maximum number of instances.

    • Example 2: A scaling activity fails because the minimum number of instances is larger than the expected number of instances.

      In this example, the maximum number of instances is 10, the minimum number of instances is 0, and the expected number of instances is 5. When you create a scheduled task for the scaling group, you set the minimum number of instances to 6. In this case, when the scheduled task triggers a scaling activity, Auto Scaling attempts to update the minimum number of instances from 0 to 6. However, the scaling activity fails because the minimum number of instances is larger than the expected number of instances.

    • Example 3: A scaling activity fails because the expected number of instances is larger than the maximum number of instances.

      In this example, the maximum number of instances is 5, the minimum number of instances is 0, and the expected number of instances is 3. When you create a scheduled task for the scaling group, you set the expected number of instances to 6. In this case, when the scheduled task triggers a scaling activity, Auto Scaling attempts to update the expected number of instances from 3 to 6. However, the scaling activity fails because the expected number of instances is larger than the maximum number of instances.

Usage notes

  • When you create or modify a scheduled task, you can set the Scaling Method parameter to only one of the following values: Select Existing Scaling Rule and Configure Number of Instances in Scaling Group.

  • When you create a scheduled task, you must configure at least one of the following parameters: Maximum Instances, Minimum Instances, and Expected Instances. The minimum number of instances must be smaller than or equal to the expected number of instances. The expected number of instances must be smaller than or equal to the maximum number of instances.

  • If you do not configure an expected number of instances when you create a scaling group, you cannot configure the Expected Instances parameter when you create or modify a scheduled task for the scaling group.

  • For scaling groups for which an expected number of instances is configured, we recommend that you configure the Maximum Instances, Minimum Instances, and Expected Instances parameters at the same time to ensure successful execution of scheduled tasks.

Procedure

  1. Log on to the Auto Scaling console.
  2. In the left-side navigation pane, choose Scaling Tasks > Scheduled Tasks.
  3. In the top navigation bar, select the region where Auto Scaling is activated.
  4. Click Create Scheduled Task.

  5. In the Create Scheduled Task dialog box, configure parameters based on your business requirements.

    When you configure the Scaling Method parameter, select Configure Number of Instances in Scaling Group, and configure the Maximum Instances, Minimum Instances, and Expected Instances parameters. For more information about other configuration items, see Create scheduled tasks.

    Note

    The Expected Instances parameter is available only after you configured an expected number of instances when you created the scaling group for which you want to create the scheduled task. Otherwise, you can configure only the Maximum Instances and Minimum Instances parameters when you create a scheduled task for the scaling group.

  6. Click OK.

  7. View the details of a scaling activity.

    After the scheduled task is executed at the specified point in time, you can go to the Scaling Activities tab to query the details of the scaling activity that corresponds to the scheduled task. You can view the instance number changes in the scaling group. For more information about how to view scaling activities, see View the details of a scaling activity. 伸缩活动