This topic describes how to update custom images by using Operation Orchestration Service (OOS). OOS provides public templates to automate image updating. To create a random or scheduled O&M task, you only need to select a source image and specify required parameters, such as the Cloud Assistant scripts in a public template. The O&M task is then automatically executed based on the definitions in the template.

Background information

The ACS-ECS-UpdateImage template defines the order in which the following tasks are executed to update the image:
  1. Check whether the name of the new custom image exists and make sure that it complies with the naming conventions.
  2. Create and launch a temporary ECS instance based on parameters such as the instance type, source image ID, and security group ID you have configured.
  3. Check whether the Cloud Assistant client has been installed on the temporary ECS instance. If not, install the Cloud Assistant client.
  4. Run scripts by using the Cloud Assistant client to update the system environment of the instance.
    Note OOS calls Cloud Assistant API operations to run Shell, Bat, or PowerShell scripts to update the system environment of ECS instances. For more information, see Cloud assistant overview.
  5. Stop the temporary ECS instance.
  6. Create a custom image from the temporary ECS instance.
  7. Release the temporary ECS instance.


  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Instances & Images > Images.
  3. In the top navigation bar, select a region.
  4. On the Images page, click the Custom Images tab and find the target image. In the Actions column, choose More > Update Image.
  5. Go to the OOS console and perform the following operations:
    1. In the Basic Information step, retain the default settings and click Next: Parameter Settings.
    2. In the Parameter Settings step, specify parameters to automate the creation or updating of custom images. The following table describes these parameters.
      Parameter Description Example
      targetImageName The name for the new custom image. The name must comply with the regular expression /^[A-Za-z0-9\-_]*$/, and cannot be the same as an existing image name. add_testtxt_20191010
      sourceImageId The ID of the image you want to update.
      Note If you have not created a custom image, you can use a public image, such as centos_7_06_64_20G_alibase_20190711.vhd.
      instanceType The type of the temporary ECS instance to create. For more information, see Instance families. ecs.g5.xlarge
      securityGroupId The ID of the security group to which the temporary ECS instance belongs. sg-bp1azkttqpldxg******
      vSwitchId The ID of the VSwitch to which the temporary ECS instance belongs. The VSwitch and security group must be in the same VPC. vsw-bp1s5fnvk4gn2tw******
      commandType The type of script you plan to execute by using the Cloud Assistant client.
      • RunShellScript: Shell script for Linux-based instances.
      • RunBatScript: Bat script for Windows-based instances.
      • RunPowerShellScript: PowerShell script for Windows-based instances.
      commandContent The content of the script to execute on the temporary ECS instance.
      echo "hello world" >/root/test.txt.
      Permissions Optional. Valid values:
      • Use Existing Permissions of Current Account: This is the default value. You have all the permissions granted to your account. Make sure that you have the permissions to call the ECS API operations required for creating custom images.
      • Specify RAM Role and Use Permissions Granted to This Role: If a RAM role is specified, OOS performs O&M tasks by assuming that RAM role.
      Use Existing Permissions from a Current Account
      Use OOS to create a custom image
    3. Click Next: Preview.
    4. Confirm O&M task details and high-risk operations. Then, click Confirm and Create.
  6. In the left-side navigation pane, click Executions to view the created O&M task.


If the O&M task is created and its execution status is Running, the custom image is being updated. If Execution Status changes to Succeeded, the image is updated. You can view the ID of the new image on the Execution Result page. Image updating results
Note To view the progress of the image updating operations, click Details of the O&M task to view Execution Logs.