You can use image templates to customize image content and create images in different regions and accounts. This topic describes how to create an image template in the Elastic Compute Service (ECS) console.
- Before you create an image template, take note of the following items:
- Only custom image templates can be created.
- You can configure only public, custom, or shared Linux images or image families as the source images of the custom image templates.
- When you use an image template to create an image, you must create an intermediate instance to help create the image. You are charged for the intermediate instance on a pay-as-you-go basis. For more information, see Pay-as-you-go.
- Each command used to create an image template cannot exceed 16 KB in size. A maximum of 127 commands can be specified.
- For information about the commands that can be used in Image Template, see Commands supported by Image Builder.
- Log on to the ECS console.
- In the left-side navigation pane, choose .
- In the top navigation bar, select a region.
- On the Image Builder Management page, click Create Image Template. If you access Image Builder for the first time, the Image Builder welcome page appears. Click Create Image Template.
- Configure parameters described in the following tables to create an image template.
Then, click Create.
After the image template is created, you can view the image template on the Image Builder Management page.
- Parameters in the Basic Information section
Parameter Description Template Name The name of the image template. This parameter is required. Description The description of the image template. Tag The tags of the image template. You can add tags to the image template to manage the image template in a centralized manner. For more information, see Overview.
- Parameters in the Configure Source Image section
Parameter Description Import Template through Dockerfile You can import the edited template content by using Dockerfile. The imported template content overwrites the Source Image Type, Image, and Image Template parameters that you specified in the ECS console. Proceed with caution. Source Image Type The type of the source image of the image template. Valid values: Images and Image Family. Image or Image Family This parameter is required and varies based on Source Image Type.Note Only Linux images are supported.
- If you set Source Image Type to Images, you can select Custom Image, Public Image, or Shared Image from the first Image drop-down list and then select an image ID or image version from the second Image drop-down list.
- If you set Source Image Type to Image Family, you must select an image family from the Image Family drop-down list.
Image Template You must configure Command and Content for the image template. For information about supported commands, see the "Context" section in this topic. After you configure the parameters, you can click Preview to view the template content.Note You can select Custom Component or System Component from the Command drop-down list and then select the ID of a component from the Content drop-down list.
- Parameters in the Configure Intermediate Instance section
Parameter Description vSwitch Select a vSwitch that is available in the current region. If you do not configure this parameter, the system creates a temporary virtual private cloud (VPC) and vSwitch. Make sure that the unused quota is sufficient in the region. Instance Type Select an instance type for the intermediate instance. If you do not configure this parameter, an instance type that provides the fewest vCPUs and memory resources is selected by default. This configuration is subject to the resource availability of instance types. For example, the ecs.g6.large instance type is selected by default. However, if available ecs.g6.large resources are insufficient, the ecs.g6.xlarge instance type is selected. System Disk Size Specify the system disk size for the intermediate instance. Unit: GiB. Valid values: 20 to 500. Default value: 40. Public Bandwidth (Mbit/s) Specify the public bandwidth for the intermediate instance. Default value: 0. This value indicates that the intermediate instance cannot access the Internet. If your image building template content contains a command that requires access to the Internet, you must set a non-zero value for the public bandwidth. Otherwise, the image building task fails. Release if Image Building Fails You can select whether to retain the intermediate instance.Note If you select No to retain the intermediate instance, you continue to be charged for the instance after the image building task fails. When the intermediate instance is no longer needed, you must manually release it in a timely manner. For more information, see Release an instance.
- Parameters in the Configure Image Distribution section
Parameter Description Destination Image Name Specify a name prefix for the image that you want to create. The system appends the ID of the image building task (ExecutionId) to the prefix to generate a full name of the image in the
<Custom name prefix>_<ID of the image building task>format.
Current Region The current region of the ECS console. Default Distribution Region If you want to copy the image that you want to create to multiple regions, you can specify the distribution regions. Then, the image is distributed to the specified regions. You can specify up to 20 distribution regions or leave this parameter empty. Shared User ID If you want to share the image that you want to create to other Alibaba Cloud accounts, you can specify the user IDs (UIDs) to share the image. Then, the image is shared to the specified Alibaba Cloud accounts within the same region as the image. You can specify up to 20 UIDs or leave this parameter empty. Execute Immediately You can select whether to immediately execute the image building task. If you select No to not immediately execute the image building task, you can manually execute the task. For more information, see Execute an image building task.
- Parameters in the Basic Information section