This topic describes the notes for creating launch templates, how to create launch templates, and operations that can be performed by using launch templates.

Background information

Before you create a launch template, take note of the following items:
  • Up to 30 launch templates can be created per region within an account.
  • When you create a launch template, all parameters are optional. However, if a launch template does not contain required parameters such as the instance type or image, you must specify these parameters when you create an instance by using the launch template.
  • Launch templates cannot be modified after they are created. However, you can create versions for launch templates.

You can create launch templates in the Elastic Compute Service (ECS) console or on the ECS instance buy page. Alternatively, you can call the CreateLaunchTemplate operation by using Alibaba Cloud SDKs, OpenAPI Explorer, and Alibaba Cloud CLI to create launch templates.

Create a launch template in the ECS console

You can create launch templates beforehand to simplify the creation of ECS instances, scaling groups, and auto provisioning groups.

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Deployment & Elasticity > Launch Templates.
  3. In the top navigation bar, select a region.
  4. On the Launch Templates page, click Create Template.
  5. On the Launch Template page, configure the parameters in the Basic Configurations (Optional) and Advanced Configuration (Optional) steps.
    For more information about the parameters and their descriptions, see Create an instance by using the wizard.
    Note The first time you create a launch template, the Clone Template section is unavailable. If you have already created launch templates, you can select an existing launch template and one of its versions and then modify the configurations.
  6. In the Confirm Configuration step, enter a template name and a template version description. Then, click Create Launch Template.
    • Selected configurations: You can click the Modify icon in the Basic Configurations or Advanced Configuration section to modify the parameters.
      Note The parameters in the Basic Configurations and Advanced Configuration sections are required to create instances and simplify subsequent instance creation. These parameters are optional and can be configured as needed.
    • Template saving method: You can select the saving method of a new launch template based on your needs. If you select New Template in the Save As section, a launch template will be created, and the current configurations will be saved as the default version of the launch template. If you select New Template Version in the Save As section, a launch template version will be created, and the current configurations will be saved as the new version of the selected launch template.
    • Launch template name and description: You can enter the name and description of the launch template for future management.
    • Resource group of the launch template: You can select an existing resource group from the Template Resource Group drop-down list.

      If you want a new resource group, click click here to go to the Resource Group page to create a resource group. For more information, see Resource groups.

    Confirm configurations
  7. In the Created message, click View Template to go to the ECS console and view the launch template that you have created.

Create a launch template on the ECS instance buy page

If you want to save the configurations of an instance for simplifying subsequent instance creation, you can create a launch template when you create the instance.

  1. Go to the Elastic Compute Service product page and click Buy Now.
  2. On the Custom Launch tab, configure parameters.
    For more information about the parameters and their descriptions, see Create an instance by using the wizard.
  3. In the Preview step, click Save as Launch Template.
  4. In the Save as Launch Template dialog box, click New Template, enter a template name and a template version description, and then click Save.
  5. In the Created message, click View Template to go to the ECS console and view the launch template that you have created.

Subsequent operations

After you create launch templates, you can use them to perform the following operations.
Operation Description References
Create an ECS instance You can use an existing launch template to quickly create an instance. This eliminates the need to repeatedly configure parameters. For more information, see Create an instance by using a launch template.
Create multiple ECS instances at a time A launch template can work with the RunInstances operation to create multiple instances at a time. This eliminates the need to configure a large number of parameters to create multiple instances.

You must specify the LaunchTemplateId and LaunchTemplateVersion parameters when you call the RunInstances operation.

For more information, see RunInstances.
Create a scaling group You can use an existing launch template to quickly create a scaling group based on ECS instances. The system uses configurations defined in the launch template to create a scaling group. If some of the configurations do not fulfill business requirements, you can modify these configurations when you create the scaling group. For example, you can modify the virtual private cloud (VPC) and vSwitch required in the scaling configuration. For more information, see Create a scaling group based on an existing ECS instance.
Create an auto provisioning group Auto provisioning groups use specific versions of launch templates as instance configuration sources. Attributes such as instance images, security groups, and logon credentials from the launch templates are used by auto provisioning groups to create ECS instances. After an auto provisioning group is created, an ECS instance cluster is started and provisioned at the specified point in time, which improves the efficiency of offering a large number of ECS instances at a time. For more information, see Create an auto provisioning group.