All Products
Search
Document Center

Auto Scaling:Instance refresh

Last Updated:Oct 30, 2024

If you prepare to modify the scaling configuration or image in your scaling group and want to apply the modifications, you can enable the Instance Refresh feature. Auto Scaling creates new instances from the modified scaling configuration or image to gradually replace the old ones. This helps gradually update the configurations of running instances, thus ensuring smooth service iteration.

Feature overview

If you want to gradually update the scaling configuration or instance image in your scaling group, you can create an instance refresh task. When the instance refresh task is started, Auto Scaling automatically creates new instances based on your desired configurations to sequentially replace old instances, which ensures smooth service iteration. The Instance Refresh feature has the following benefits:

  • Thorough update: This feature enables Auto Scaling to create new instances and gradually release old ones.

    The difference between the Instance Refresh feature and the Rolling Update feature is that the Instance Refresh feature releases old instances, while the Rolling Update feature updates instance images in batches without releasing the old ones.
  • Temporary fluctuations between actual and expected numbers of instances: Auto Scaling allows for temporary fluctuations in the number of instances, which can vary above or below the expected number during instance refresh. You can manage the level of fluctuations based on your business requirements.

  • No impacts on scaling operations: When an instance refresh task is executed, scaling operations will continue as planned. If a scale-out operation is initiated, Auto Scaling will utilize the specified scaling configuration or image from the instance refresh task to create new instances. This maintains consistent configurations within the scaling group.

    Rolling update tasks will pause ongoing scaling operations. This is different from instance refresh tasks.
  • No impacts on instances in the In Service state: Auto Scaling does not switch old instances into the Protected state during instance refresh. Instead, it creates new instances before releasing the old ones, for a smooth transition.

  • Automatic adjustment of the scaling configuration: After an instance refresh task is complete, Auto Scaling applies the expected configurations, or directly changes the image in the old scaling configuration.

Limits

  • You can enable the Instance Refresh feature only if your scaling group is of the Elastic Compute Service (ECS) type.

  • If the Instance Reclaim Mode parameter of your scaling group is set to Economical Mode or Forcibly Recycle, you cannot enable the Instance Refresh feature.

  • If the Measure Scaling Group Capacity by Using vCPUs option of the active scaling configuration of your scaling group is selected, you cannot enable the Instance Refresh feature. In addition, if you create an instance refresh task, then you cannot select the Measure Scaling Group Capacity by Using vCPUs option in the scaling configuration generated from the expected configurations provided by the task.

Usage process

Scenario 1: Update only the instance image

If you want to update only your service application or internal configurations of your instances, you can refer to the following process:

  1. Prepare a new image.

    First, you must prepare a new image that you want to use. After instance refresh is complete, new instances created by Auto Scaling use the new image. For information about how to create a custom image, see Create a custom image from an instance.

  2. Start an instance refresh task.

    When you start an instance refresh task, you must specify the image you want to use and the method to gradually update instances. For information about how to start an instance refresh task, see Start an instance refresh task.

  3. Monitor the instance refresh task.

    You must constantly monitor the status of the instance refresh task, and pause, cancel, or roll it back if needed. For more information, see Operations supported on an instance refresh task.

Scenario 2: Update the scaling configuration from which instances are created

If you want to modify specific parameters in the active scaling configuration and plan to apply the modifications, you can refer to the following process:

  1. Create a new scaling configuration.

    First, you must prepare a new scaling configuration. During instance refresh, Auto Scaling creates new instances from the new scaling configuration. For information about how to create a scaling configuration, see Create a scaling configuration of the ECS type.

    Why a new scaling configuration is necessary: When you create an instance refresh task, Auto Scaling filters the instances not created from the desired scaling configuration to update. If you first modify the scaling configuration and then refresh instances, the refresh operation may fail. In addition, if exceptions occur after the refresh operation is complete, a clear scaling configuration can help you efficiently locate the original scaling configuration and roll back the refresh operation.
  2. Start an instance refresh task.

    When you start an instance refresh task, you must specify the scaling configuration you want to use and the method to gradually update instances. For information about how to start an instance refresh task, see Start an instance refresh task.

  3. Monitor the instance refresh task.

    You must constantly monitor the status of the instance refresh task, and pause, cancel, or roll it back if needed. For more information, see Operations supported on an instance refresh task.

Operations supported on an instance refresh task

Entry to the Instance Refresh tab

You can manage instance refresh tasks only on the Instance Refresh tab. To go there, perform the following steps:

Go to the Instance Refresh tab

  1. Log on to the Auto Scaling console.

  2. In the left-side navigation pane, click Scaling Groups.

  3. In the top navigation bar, select a region.

  4. On the Scaling Groups page, find the scaling group that you want to use and click its name to go to the scaling group details page.

  5. Click the Instance Refresh tab.

    image

Start an instance refresh task

Important
  • You can start only one instance refresh task at a time in a scaling group.

  • During the execution of an instance refresh task, you cannot modify the active scaling configuration.

  1. On the Instance Refresh tab, click Instance Refresh.

  2. In the Instance Refresh dialog box, configure the Expected Configuration and Configure Capacity Policy parameters as prompted.

    How do I configure the Configure Capacity Policy parameter?

    Be sure to note the following items when configuring a capacity policy:

    • Uptime Percentage > Min: The percentage of instances that are in the In Service state relative to all instances in the scaling group during instance refresh.

    • Uptime Percentage > Max: The percentage of instances that can exceed the upper limit of the scaling group capacity relative to all instances in the scaling group during instance refresh.

    When you configure the preceding parameters, you can refer to the following cases:

    • Prioritize service availability

      If you prioritize service availability, you can select the Create Before Release option. In this case, Auto Scaling begins by launching new instances, and only releases old instances after the new ones are ready during instance refresh. You can configure the Max parameter based on your business requirements. Configuring the Max parameter can help you control how efficiently instances are created and how many instance batches are generated, thus preventing additional costs.

      For example, to update instances in two batches, each containing half the instances, you can set the Max parameter to 150. This allows new instances to temporarily exceed the scaling group capacity by 50%. When new instances are ready, Auto Scaling replaces the old instances with the new ones until the expected number is reached. In the Estimated Group Capacity section, you can view the settings of the Temporary Min Healthy Instances and Temporary Max Healthy Instances parameters.
    • Prioritize cost efficiency

      If you prioritize cost efficiency, you can select the Create and Release at One Time option. In this case, Auto Scaling releases old instances and creates new ones at the same time during instance refresh. You can configure the Min parameter to control the minimum number of available instances.

    • Balance service availability and cost efficiency

      If you want to balance service availability and cost efficiency, you can select the Custom Policy option and configure the Min and Max parameters at the same time.

  3. Confirm your configurations and click Start Refresh.

Pause or resume an instance refresh task

If you encounter problems during the execution of an instance refresh task, you can pause the task to troubleshoot. Based on the results, you can then decide whether to continue the task. The following figures show the buttons that you can click to pause or resume an instance refresh task.

Important

If new instances have been initialized or added to the scaling group before you pause the instance refresh task, the initialize or add operation will still continue even after you pause the task.

Pause an instance refresh task

image

Resume an instance refresh task

image

Roll back an instance refresh task

If you encounter problems during the execution of an instance refresh task, you can roll back the task to reuse the previous scaling configuration or image. The following figure shows the button that you can use to roll back an instance refresh task.

image

Cancel an instance refresh task

In addition to the rollback operation, you can cancel an ongoing instance refresh task. The following figure shows the button that you can use to cancel an instance refresh task.

Important

In the rollback operation, instances whose configurations had already been updated by running an instance refresh task remain intact even after you cancel the task. This is different from the rollback operation.

image