Rolling update tasks can be used to update the configurations of multiple Elastic Compute Service (ECS) instances or elastic container instances at the same time. You can use rolling update tasks to update images, run scripts, or install Operation Orchestration Service (OOS) packages on multiple ECS instances or elastic container instances that are in the In Service state. The ECS instances or elastic container instances must be in the same scaling group.

Prerequisites

  • Before you update the existing images for ECS instances or elastic container instances in a scaling group, you must prepare new images.
  • Scripts are prepared before you run scripts on ECS instances or elastic container instances in a scaling group.
  • OOS packages are prepared before you install the OOS packages on ECS instances or elastic container instances in a scaling group. For more information, see Manage custom software on multiple ECS instances.

Background information

The following table describes the types of tasks that are supported by the rolling update feature.

Type Description
Image update You can create an image update task to update the OSs of multiple ECS instances or elastic container instances that are in the In Service state at the same time. The ECS instances or elastic container instances must be in the same scaling group.

Before you run an image update task, take note that the image update task may have the following impacts on the instance configuration source of the scaling group:

  • If the instance configuration source is a scaling configuration, the image in the scaling configuration that is in the Enabled state is automatically updated. The images in scaling configurations that are in the Disabled state in the scaling group are not updated.
  • If the instance configuration source is a launch template, the image in the launch template is not automatically updated. You must manually update the image in the launch template.
Note You can create rolling update tasks or image update tasks to update images in your scaling configurations based on your business requirements. For more information, see Compare rolling update with image update.
Script running You can create a script running task to perform one or more O&M operations at the same time. Examples:
  • View and update system configurations such as disk space.
  • Install common software such as Apache.
  • Deploy service code.
OSS package installation You can create an OSS package installation task to install or uninstall software on multiple ECS instances or elastic container instances at the same time.

Usage limits

  • The rolling update feature is available only in regions where OOS is supported.
  • The scaling group for which you want to enable the rolling update feature must have no ongoing scaling activities.
  • You can run only one rolling update task at a time.

Compare rolling update with image update

  • Image update allows the images in scaling configurations to be updated to new images. This way, instances that are created based on the scaling configurations can use the new images. For more information, see Automatically update images in scaling configurations.
  • Rolling update allows the images that are used by existing instances in scaling groups to be updated to the latest version.

Create and run a rolling update task

  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. Find a scaling group and go to the details page of the scaling group. You can use one of the following methods to go to the details page:
    • Click the ID of the scaling group in the Scaling Group Name/ID column.
    • Click Details in the Actions column of the scaling group.
  5. In the upper part of the page, click the Rolling Update tab.
  6. Click Create Execution Task.
  7. In the Create Execution Task dialog box, configure the following parameters and then click Create Task.
    The following table describes the parameters.
    Parameter Description
    Task Description The description of the rolling update task.
    Task Type
    • Image Update: You can create this type of task to replace images of ECS instances or elastic container instances. You can select a public image, a custom image, a shared image, or an image from Alibaba Cloud Marketplace. The ECS instances or elastic container instances are restarted during the update. You must also configure the following parameters:
      • Image for Update: the image that is used in the update task.
      • Image for Rollback: the image that is used in the rollback task.
        Note When you create a rollback task, the image that you selected for the Image for Rollback parameter is used. You can select other images based on your business requirements.
    • Script Execution: You can create this type of task and use Cloud Assistant to run scripts without the need to stop ECS instances or elastic container instances.
      • In the Script Type section, select one of the following script types:
        • Linux Shell: Examples of this script type are echo hello and hostname.
        • Windows Bat: An example of this script type is dir c:\.
        • Windows PowerShell: An example of this script type is Get-Services.
      • Script for Execution: the script that is used to run the update task.
      • Script for Rollback: the script that is used to run the rollback task.
        Note When you create a rollback task, the script that you selected for the Script for Rollback parameter is used. You can modify the script based on your business requirements.
    • Install OOS Package: You can create this type of task to install OOS packages. Select the name and version of the package that you want to install.
    Execution Batch The number of batches that are required to run the task. The task is run in multiple batches, and each ECS instance or elastic container instance is updated as part of a specific batch. Each batch contains at least one ECS instance or elastic container instance. For example, if a scaling group has 10 ECS instances that are in the In Service state and the Execution Batch parameter is set to 2, the task is run in two batches with five ECS instances in each batch.
    Suspension Policy
    • Without Suspension: Auto Scaling runs the task without interruptions.
    • Suspend First Batch: Auto Scaling suspends the task after the first batch is completed. If you want to continue the task, you must manually resume the task. After you manually resume the task, the task is not suspended in subsequent batches.
    • Suspend Each Batch: Auto Scaling suspends the task each time after a batch is completed. You must manually continue the task after each batch is complete.
  8. Read and understand the impacts of the rolling update task and click OK.
    Then, the rolling update task is automatically run. The rolling update process has the following impacts on the scaling group and on the ECS instances or elastic container instances in the scaling group:
    • If scaling activities are in progress during the execution of the rolling update task, Auto Scaling suspends the scaling activities. After the rolling update task is completed, Auto Scaling resumes the scaling activities. If you manually suspend scaling activities before the rolling update task is run, the scaling activities remain suspended until the task is completed. This ensures that the status of the scaling activities remains unchanged before and after the task is run.
    • Auto Scaling changes the status of ECS instances or elastic container instances to Standby in batches and restores the instances to the In Service state after the rolling update task is completed.
      Note If the scaling group is associated with Server Load Balancer (SLB) instances, the SLB weights of the ECS instances or elastic container instances that are in the Standby state are set to zero and no business traffic is received.
  9. Perform the operations that are described in the following table based on the status of the rolling update task.
    Item Description Procedure
    Continue the rolling update task If the suspension policy of the rolling update task is Suspend First Batch or Suspend Each Batch, the task enters the Pending (Batch Suspension) state once or multiple times. Check whether the updated ECS instances or elastic container instances meet your business requirements. After you confirm the relevant information, continue the rolling update task.
    1. Click Continue in the Actions column.
    2. In the Continue Execution Task message, click OK.
    Complete the rolling update task If the rolling update task fails to be run, the task enters the Pending (Failure Suspension) state. In this case, you can manually complete the rolling update task.
    1. Click Details in the Actions column.
    2. Find the ECS instance or elastic container instance that is in the Failure state and click Retry, Skip, or Cancel in the Actions column.
      • Click Retry to retry rolling update for the ECS instance or elastic container instance.
      • Click Skip to perform rolling update for the next ECS instance or elastic container instance. The status of the ECS instance or elastic container instance that is skipped is changed to Success.
        Important You must manually remove the ECS instance or elastic container instance that is skipped from the Standby state.
      • Click Cancel to perform rolling update for the next ECS instance or elastic container instance. The status of the ECS instance or elastic container instance for which the rolling update task is canceled is changed to Failure.
    Cancel the rolling update task If the rolling update task does not meet your business requirements, you can cancel the task. Click Cancel in the Actions column.
    Important After you cancel the rolling update task, you must manually resume the suspended scaling activities and remove the ECS instances or elastic container instances that are in the Failure state or are being updated in the current batch from the Standby state.
    Roll back the rolling update task If the rolling update task is in the Pending (Batch Suspension) or Pending (Failure Suspension) state or is recently run, you can roll back the rolling update task. For more information, see Roll back a rolling update task.

Roll back a rolling update task

To restore the configurations of ECS instances or elastic container instances when an error occurs, you can roll back a rolling update task that is in the Pending (Batch Suspension) or Pending (Failure Suspension) state. You can also roll back the most recent rolling update task that is run. You cannot roll back a rollback task.
Note If you roll back a rolling update task that is in the Pending state, the rolling update task is canceled. The instances that are updated are rolled back.
  1. In the task list, find the rolling update task that you want to roll back and click Rollback in the Actions column.
  2. In the Create Rollback Task dialog box, configure the parameters.
    The following table describes the parameters.
    Parameter Description
    Task Description The description of the rollback task.
    Task Type The task type is the same as the task type of the rolling update task. You cannot change the task type.
    • If the task type is Image Update, the image that you selected for the Image for Rollback parameter when you created the rolling update task is automatically selected. You can select other images based on your business requirements.
    • If the task type is Script Execution, the script that you selected for the Script for Rollback parameter when you created the rolling update task is automatically used. You can modify the script based on your business requirements.
    • If the task type is Install OOS Package, the version of the OOS package that you specified when you created the rolling update task is automatically selected. You can select other versions based on your business requirements. You cannot select other packages.
    Execution Batch The number of batches that are required to run the task. The task is run in multiple batches, and each ECS instance or elastic container instance is rolled back as part of a specific batch. Each batch contains at least one ECS instance or elastic container instance. For example, if a scaling group has 10 ECS instances that are in the In Service state, and the Execution Batch parameter is set to 2, the task is run in two batches with five ECS instances in each batch.
    Suspension Policy
    • Without Suspension: Auto Scaling runs the task without interruptions.
    • Suspend First Batch: Auto Scaling suspends the task after the first batch is completed. If you want to continue the task, you must manually resume the task.
    • Suspend Each Batch: Auto Scaling suspends the task each time a batch is completed. You must manually continue the task.
  3. Click Create Task.
  4. Read and understand the impacts of the rollback task and click OK.
    The rollback task is automatically run.

View the details of a rolling update task

You can view the details of a rolling update task and retry, skip, or cancel a rolling update for an ECS instance or elastic container instance.

  1. In the task list, find the rolling update task whose details you want to view and click Details in the Actions column.
  2. View basic task information.
    The basic task information includes the task status and the task type. If the task type is Script Execution, click Script Details to view the details of the script.
  3. View the instance list.
    The ECS instances or elastic container instances that are in various states are displayed.
    • If the rolling update is not completed for an ECS instance or elastic container instance, you can skip or cancel the rolling update for the instance.
    • If an ECS instance or elastic container instance fails to be updated, you can retry, skip, or cancel the rolling update for the instance in the Actions column.
    • If the task type is Script Execution, click View in the Result column to view the output of the script.
    The following section describes the differences between retrying, skipping, and canceling a rolling update for an ECS instance or elastic container instance:
    • Click Retry to retry the rolling update for the ECS instance or elastic container instance.
    • Click Skip to perform the rolling update for the next ECS instance or elastic container instance. The status of the ECS instance or elastic container instance that is skipped is changed to Success.
      Important You must manually remove the ECS instance or elastic container instance that is skipped from the Standby state.
    • Click Cancel to perform the rolling update for the next ECS instance or elastic container instance. The status of the ECS instance or elastic container instance for which the rolling update task is canceled is changed to Failure.