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.
- Check whether the name of the new custom image exists and make sure that it complies with the naming conventions.
- 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.
- Check whether the Cloud Assistant client has been installed on the temporary ECS instance. If not, install the Cloud Assistant client.
- Run scripts by using the Cloud Assistant client to update the system environment of
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.
- Stop the temporary ECS instance.
- Create a custom image from the temporary ECS instance.
- Release the temporary ECS instance.
- Log on to the ECS console.
- In the left-side navigation pane, choose .
- In the top navigation bar, select a region.
- On the Images page, click the Custom Images tab and find the target image. In the Actions column, choose .
- Go to the OOS console and perform the following operations:
- In the Basic Information step, retain the default settings and click Next: Parameter Settings.
- 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. m-bp13y4of6mdoqw****** 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.
RunShellScript 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
- Click Next: Preview.
- Confirm O&M task details and high-risk operations. Then, click Confirm and Create.
- In the left-side navigation pane, click Executions to view the created O&M task.