Modify a launch template (manage launch template versions) - Amazon Elastic Compute Cloud
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Modify a launch template (manage launch template versions)

Launch templates are immutable; after you create a launch template, you can't modify it. Instead, you can create a new version of the launch template that includes any changes you require.

You can create different versions of a launch template, set the default version, describe a launch template version, and delete versions that you no longer require.

Create a launch template version

When you create a launch template version, you can specify new launch parameters or use an existing version as the base for the new version. For more information about the launch parameters, see Create a launch template.

Console
To create a launch template version
  1. Open the Amazon EC2 console at https://console.amazonaws.cn/ec2/.

  2. In the navigation pane, choose Launch Templates.

  3. Select a launch template, and then choose Actions, Modify template (Create new version).

  4. For Template version description, enter a description for this version of the launch template.

  5. (Optional) Expand Source template and select a version of the launch template to use as a base for the new launch template version. The new launch template version inherits the launch parameters from this launch template version.

  6. Modify the launch parameters as required, and choose Create launch template.

Amazon CLI
To create a launch template version
  • Use the create-launch-template-version command. You can specify a source version on which to base the new version. The new version inherits the launch parameters from this version, and you can override parameters using --launch-template-data. The following example creates a new version based on version 1 of the launch template and specifies a different AMI ID.

    aws ec2 create-launch-template-version \ --launch-template-id lt-0abcd290751193123 \ --version-description WebVersion2 \ --source-version 1 \ --launch-template-data "ImageId=ami-c998b6b2"

Set the default launch template version

You can set the default version for the launch template. When you launch an instance from a launch template and do not specify a version, the instance is launched using the parameters of the default version.

Console
To set the default launch template version
  1. Open the Amazon EC2 console at https://console.amazonaws.cn/ec2/.

  2. In the navigation pane, choose Launch Templates.

  3. Select the launch template and choose Actions, Set default version.

  4. For Template version, select the version number to set as the default version and choose Set as default version.

Amazon CLI
To set the default launch template version
  • Use the modify-launch-template command and specify the version that you want to set as the default.

    aws ec2 modify-launch-template \ --launch-template-id lt-0abcd290751193123 \ --default-version 2

Describe a launch template version

Using the console, you can view all the versions of the selected launch template, or get a list of the launch templates whose latest or default version matches a specific version number. Using the Amazon CLI, you can describe all versions, individual versions, or a range of versions of a specified launch template. You can also describe all the latest versions or all the default versions of all the launch templates in your account.

Console
To describe a launch template version
  1. Open the Amazon EC2 console at https://console.amazonaws.cn/ec2/.

  2. In the navigation pane, choose Launch Templates.

  3. You can view a version of a specific launch template, or get a list of the launch templates whose latest or default version matches a specific version number.

    • To view a version of a launch template: Select the launch template. On the Versions tab, from Version, select a version to view its details.

    • To get a list of all the launch templates whose latest version matches a specific version number: From the search bar, choose Latest version, and then choose a version number.

    • To get a list of all the launch templates whose default version matches a specific version number: From the search bar, choose Default version, and then choose a version number.

Amazon CLI
To describe a launch template version
  • Use the describe-launch-template-versions command and specify the version numbers. In the following example, versions 1 and 3 are specified.

    aws ec2 describe-launch-template-versions \ --launch-template-id lt-0abcd290751193123 \ --versions 1 3
To describe all the latest and default launch template versions in your account
  • Use the describe-launch-template-versions command and specify $Latest, $Default, or both. You must omit the launch template ID and name in the call. You cannot specify version numbers.

    aws ec2 describe-launch-template-versions \ --versions "$Latest,$Default"

Delete a launch template version

If you no longer require a launch template version, you can delete it.

Considerations
  • You can't replace the version number after you delete it.

  • You can't delete the default version of the launch template; you must first assign a different version as the default. If the default version is the only version for the launch template, you must delete the entire launch template.

  • When using the console, you can delete one launch template version at a time. When using the Amazon CLI, you can delete up to 200 launch template versions in a single request. To delete more than 200 versions in a single request, you can delete the launch template, which also deletes all of its versions.

Console
To delete a launch template version
  1. Open the Amazon EC2 console at https://console.amazonaws.cn/ec2/.

  2. In the navigation pane, choose Launch Templates.

  3. Select the launch template and choose Actions, Delete template version.

  4. Select the version to delete and choose Delete.

Amazon CLI
To delete a launch template version
  • Use the delete-launch-template-versions command and specify the version numbers to delete. You can specify up to 200 launch template versions to delete in a single request.

    aws ec2 delete-launch-template-versions \ --launch-template-id lt-0abcd290751193123 \ --versions 1