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:
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.
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.
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:
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.
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.
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:
Start an instance refresh task
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.
On the Instance Refresh tab, click Instance Refresh.
In the Instance Refresh dialog box, configure the Expected Configuration and Configure Capacity Policy parameters as prompted.
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.
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
Resume an instance refresh task
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.
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.
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.