All Products
Search
Document Center

Auto Scaling:Update an image in a scaling configuration

Last Updated:Feb 18, 2024

An image provides the system environment, application environment, and software configuration data that are required to create Elastic Compute Service (ECS) instances. You must update your image based on your business requirements. In a scaling configuration, image is a frequently updated configuration item. You can update an image in a scaling configuration based on your business requirements by using one of the following methods: manual update and automatic update.

Background information

  • This topic is applicable to only scaling groups of the ECS type.

  • Auto Scaling supports manual image update and automatic image update in scaling configurations. For more information about the update methods, see Comparison between manual update and automatic update.

    Important

    When you create an image update task, Auto Scaling automatically creates a custom image for the source ECS instances. This incurs snapshot fees. For more information about the pricing of ECS snapshots, see Snapshots.

Comparison between manual update and automatic update

  • Manual update: applicable to scenarios in which the service demand is stable. In this kind of scenario, you can participate in the whole process and flexibly update your image.

  • Automatic update: applicable to scenarios in which applications are frequently published. In this kind of scenario, you can create image update tasks in the Auto Scaling console. When the specified execution time arrives, Auto Scaling immediately creates a custom image based on a source ECS instance and updates the image in the active scaling configuration. Automatic update is convenient compared to manual update. Automatic update simplifies update operations, requires little focus, and greatly shortens the period that is required to complete the update.

The following table describes the two update methods.

Scenario

Manual update

Automatic update

  • The current scaling group is of the ECS type.

  • The scaling configuration of the current scaling group uses Image A.

  • To publish a new version of an application, you must replace Image A of the current scaling group with Image B.

  1. Manually create Image B for the ECS instances on which you want to publish the new version of the application. For more information, see Create a custom image from a snapshot or Create a custom image from an instance.

  2. After Image B is created, manually replace Image A with Image B. For more information, see Manually update an image in a scaling configuration.

  1. Create an image update task to automatically create Image B for the ECS instances on which you want to publish the new version of the application.

  2. After Image B is created, Auto Scaling replaces Image A with Image B.

Manually update an image in a scaling configuration

  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 the region where Auto Scaling is activated.

  4. Find the scaling group whose instances you want to view and click Details in the Actions column.

  5. In the upper part of the scaling group details page, click the Instance Configuration Sources tab.

  6. On the scaling group details page, click the Scaling Configurations tab.

  7. On the Scaling Configurations tab, find the scaling configuration whose image you want to update and click Edit Image in the Actions column.

    Note

    You can modify the image regardless of whether the scaling configuration is in the Active or Inactive state.

  8. In the Edit Image dialog box, select an image type and the desired image, and click OK.

    You can set the Image parameter to Public Image, Custom Image, or Shared Image. For more information, see Image overview.image

    After the update is complete, you can go back to the scaling configuration list to view the new image in the Image column.

Automatically update an image in a scaling configuration

Comparison between image update and rolling update

  • Image update allows automatic update of images in scaling configurations. This way, instances that are created based on the scaling configurations can use the new images. For more information, see the Procedure section of this topic.

  • Rolling update allows images that are used by existing instances in scaling groups to be updated to the latest version. For more information, see Rolling update.

Prerequisites

Image update tasks are executed by using CloudOps Orchestration Service (OOS). You must authorize OOS to perform operations on related resources. Make sure that at least one of the following requirements is met:

  • The operation permissions on cloud resources, such as ECS and Auto Scaling, are granted to your Alibaba Cloud account.

  • A Resource Access Management (RAM) role is created for OOS. The operation permissions on cloud resources, such as ECS and Auto Scaling, are granted to the RAM role. For more information, see Grant RAM permissions to OOS.

    Note

    We recommend that you attach the AliyunECSFullAccess and AliyunESSFullAccess policies to the RAM role.

Procedure

  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 the region where Auto Scaling is activated.

  4. Find the desired scaling group and click Details in the Actions column.

  5. In the upper part of the scaling group details page, click the Instance Configuration Sources tab.

  6. Click the Update Image Tasks tab.

  7. Click Update Image.

  8. In the Update Image dialog box, configure parameters based on your business requirements.

    The following table describes the parameters.

    Parameter

    Description

    Instance

    Select an ECS instance. Auto Scaling creates a custom image based on the ECS instance and uses the custom image to replace the image in the scaling configuration. The custom image contains only data of the system disk of the ECS instance.

    Custom Image Name

    Auto Scaling automatically adds a suffix to the custom image name to ensure that the name is different from the image name that is generated by a scheduled task. The name suffix of a custom image is in the _on_{{ ACS::ExecutionId }}_at_{{ Acs::CurrentDate }} format. In the format, ACS::ExecutionId specifies the execution ID of the selected OOS template and Acs::CurrentDate specifies the time when the update task is executed.

    Configuration Source

    Scaling Configuration is the default value.

    Scaling Configuration ID

    Select the scaling configuration whose image you want to update. You can select multiple scaling configurations.

    Executed At

    Specify the point in time at which you want to execute the image update task.

    • Now: The task is immediately executed after the task is created.

    • Scheduled: The task is executed at a specified point in time. You must specify the execution time in minutes.

    • Periodic: Specify the recurrence period, expiration time, and start time of the image update task. Sample settings:

      • Recurrence: Monthly

      • Executes from Day 21 to Day 25 of Each Month

      • Start Time: 02:00:00

      • Expired At: 00:00:00 on August 26, 2020

      The image update task is executed at 02:00:00 each day from August 21, 2020 to August 25, 2020.

    Permission Source

    Specify the source of the permissions on related OOS resources. Valid values:

    • Use Existing Permissions of Current Account: Use the permissions of the current Alibaba Cloud account.

    • Specify RAM Role and Use Permissions Granted to This Role: Select a RAM role that you want OOS to assume and use the permissions that are granted to this role.

    Note

    If you set the Executed At parameter to Scheduled or Periodic, you can specify only a RAM role.

  9. Click OK.

    When the specified execution time arrives, Auto Scaling automatically executes the image update task. You can go back to the Update Image Tasks tab to view the information about the source ECS instance and check the task status.更新镜像任务

    After Auto Scaling completes the image update task, you can go back to the Scaling Configurations tab to check the result. If the image name in the Image column is in the UpdateImage_from_<Source ECS instance ID>_on_<Image update task ID> format, the image is updated.更新镜像结果