CloudOps Orchestration Service (OOS) provides the public template ACS-ECS-CreateAndCopyImage for custom image creation. You can use this template to send remote commands, create a custom image, and copy the image to other regions in a single operation.
Procedure
Go to the OOS image creation page.
Log on to the ECS console.
In the upper-left corner of the page, select the resource group and region of the target resource.
Click Create Image and select Use OOS to Create.
On the task execution page, the Create Image from Instance method is selected by default. Configure the following settings:
In the Common Settings section, enter a name in the Image Name field and select a Permission Source.
You can select Use existing permissions of the current account or Specify a RAM role. In this example, select Specify a RAM role and use the OOSServiceRole role.
NoteIf your account does not have a RAM role for OOS to assume, configure one first. If you already know how to configure RAM permissions for OOS, click Configure RAM Permissions to complete the setup.
In the Select Instances section, select the ECS instance from which you want to create the custom image.
When you create a custom image, snapshots are automatically generated for the instance disks. Snapshot storage incurs fees as long as the custom image is retained.
In the Send Remote Command section, select a command type that matches the instance operating system and enter the command content.
The remote command runs on the instance before the custom image is created. For example, you can use this command to install software or record the task execution time.
In the Image Distribution section, configure the following parameters:
Parameter Description Destination Regions After the image is created in the current region, automatically copy it to one or more destination regions. Share with Accounts After the image is created, automatically share it with one or more Alibaba Cloud accounts. In the Scaling Configuration section, select a scaling configuration ID.
After the image is created, the specified scaling configuration is automatically updated to use the new image.
(Optional) In the Execution Settings section, configure tags, resource groups, and other settings as needed.
Click Start Execution. In the Parameter Confirmation dialog box, verify that the parameters are correct and click OK.
When the task status changes to Success, the custom image is created and operations such as cross-region copy are complete. You can view the created image in the custom image list.
NoteWhile the task status is Running, you can click the Output or Logs tab to view output parameters and execution logs.
What's next
After you create a custom image, you can use it to:
Create an ECS instance from the custom image
Copy the custom image to another region
Share or unshare the custom image
Export the custom image
Delete the custom image