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

Prerequisites

  • Images are created before you update images for ECS instances in a scaling group.
  • Scripts are prepared before you execute scripts on ECS instances in a scaling group.
  • OOS packages are created before you install the OOS packages on ECS 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.

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

When you execute an image update task, take note of 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 the 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 need to manually update the image in the launch template.
Script execution You can create a script execution task to perform a single O&M operation or multiple 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 multiple software at the same time.

Limits

  • The rolling update feature takes effect only on ECS instances that are in the In Service state in a scaling group. You cannot enable the rolling update feature for elastic container instances in a scaling group.
  • The rolling update feature is available only in regions in which OOS is supported. OOS is not supported in the China (Qingdao), China (Ulanqab), China (Heyuan), US (Silicon Valley), and UAE (Dubai) regions. Therefore, the rolling update feature is unavailable in these regions.
  • No scaling activities are in progress in the scaling group.
  • You can execute only one rolling update task at a time.

Create and execute 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 click Create Task.
    The following table describes the parameters.
    Parameter Description
    Task Description The description of the rolling update task.
    Task Type
    • Update Image: You can create this type of task to replace images of ECS instances. You can select a public image, a custom image, a shared image, or an image from Alibaba Cloud Marketplace. The ECS instances are restarted during the update. You must configure the following parameters:
      • Image for Update: the image that is used to execute the rolling update task
      • Image for Rollback: the image that is used to execute the rollback task
        Note By default, the image that you used when you created the rolling update task is automatically selected. You can select other images.
    • Script Execution: You can create this type of task and use Cloud Assistant to execute scripts without the need to stop ECS instances. You must configure the following parameters:
      • In the Script Type section, select one of the following script types:
        • Linux Shell: such as echo hello and hostname
        • Windows Bat: such as dir c:\
        • Windows PowerShell: such as Get-Services
      • Script for Execution: the script that is used to execute update tasks.
      • Script for Rollback: the script that is used to execute rollback tasks
        Note By default, the script that you used when you created the rolling update task is automatically 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 is required to execute the task. The task is executed in multiple batches, and each ECS instance is updated as part of a specific batch. Each batch contains at least one ECS instance. For example, if a scaling group has 10 ECS instances in the In Service state, and Execution Batch is set to 2, the task is executed in two batches with five ECS instances in each batch.
    Suspension Policy
    • Without Suspension: Auto Scaling executes the task without interruptions.
    • Suspend First Batch: Auto Scaling suspends the task after the first batch is complete. You must manually continue the task. After you manually continue the task, the task is not suspended in subsequent batches.
    • Suspend Each Batch: Auto Scaling suspends the task each time after a batch is complete. You must manually continue the task after each batch is complete.
  8. View the impacts of the execution and click OK.
    Then, the rolling update task is automatically executed. Executing the rolling update task has the following impacts on the scaling group and ECS instances in the scaling group:
    • If scaling activities are in progress when a rolling update task is executed, Auto Scaling suspends the scaling activities. After the rolling update task is complete, Auto Scaling resumes the scaling activities. If you manually suspend scaling activities before the task is executed, the scaling activities remain suspended until the task is complete. This ensures that the status of the scaling activities remains unchanged before and after the task is executed.
    • Auto Scaling changes the state of ECS instances to Standby in batches and restores the instances to the In Service state after the execution is complete.
      Note If the scaling group is associated with Server Load Balancer (SLB) instances, the SLB weight values of the ECS instances that are in the Standby state are set to zero and no business traffic is received.
  9. Perform the following operations based on the execution status of 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 one or more times. Confirm whether the updated ECS instances meet your business requirements. Perform the following operations after you confirm the information:
      1. Click Continue in the Actions column.
      2. In the Continue Execution Task message, click OK.
    • If the rolling update task fails to be executed, the task enters the Pending (Failure Suspension) state. To continue this task, perform the following operations:
      1. Click Details in the Actions column.
      2. Find the ECS instance that is in the Failure state, and click Retry, Skip, or Cancel in the Actions column.
        • Click Retry to execute rolling update for the ECS instance again.
        • Click Skip to execute rolling update for the next ECS instance. The state of the ECS instance that is skipped is changed to Success.
          Notice You must manually remove the ECS instance that is skipped from the Standby state.
        • Click Cancel to execute rolling update for the next ECS instance. The state of the ECS instance for which the rolling update task is canceled is changed to Failure.
    • If you want to cancel the rolling update task, click Cancel in the Actions column.
      Notice After you cancel the rolling update task, you must manually resume the suspended scaling activities and remove the ECS instances that are in the Failure state or are being updated in the current batch from the Standby state.
    • For more information, see Roll back a rolling update task.

Roll back a rolling update task

To restore the configurations of ECS 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 executed. You cannot roll back a rollback task.
Note Before you roll back a rolling update task that is in the Pending state, the rolling update task is canceled. Instances that are updated are rolled back.
  1. In the execution 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 following 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 used 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 specified 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 is required to execute the task. The task is executed in multiple batches, and each ECS instance is updated as part of a specific batch. Each batch contains at least one ECS instance. For example, if a scaling group has 10 ECS instances in the In Service state, and Execution Batch is set to 2, the task is executed in two batches with five ECS instances in each batch.
    Suspension Policy
    • Without Suspension: Auto Scaling executes the task without interruptions.
    • Suspend First Batch: Auto Scaling suspends the task after the first batch is complete. You must manually continue the task.
    • Suspend Each Batch: Auto Scaling suspends the task each time after a batch is complete. You must manually continue the task after each batch is complete.
  3. Click Create Task.
  4. View the impacts of the rollback task and click OK after you confirm the information.
    Then, the rollback task is automatically executed.

View the details of a rolling update task

You can view the details of a rolling update task and retry or skip the task that is created for an ECS instance.

  1. In the execution task list, find the task whose details you want to view and click Details in the Actions column.
  2. View basic task information.
    The basic task information contains 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 execution instance list.
    ECS instances that are in various states are displayed.
    • If you do not update an ECS instance, you can skip or cancel the task that is created for the instance.
    • If an ECS instance fails to be updated, you can retry, skip, or cancel the task that is created for the instance in the Actions column.
    • If the task type is Script Execution, click View in the Result column to view the execution result of the script.
    The following section describes the differences between retrying, skipping, and canceling a task that is created for an ECS instance:
    • Click Retry to execute rolling update for the ECS instance again.
    • Click Skip to execute rolling update for the next ECS instance. The state of the ECS instance that is skipped is changed to Success.
      Notice You must manually remove the ECS instance that is skipped from the Standby state.
    • Click Cancel to execute rolling update for the next ECS instance. The state of the ECS instance for which the rolling update task is canceled is changed to Failure.