Menu
Amazon Elastic Compute Cloud
API Reference (API Version 2016-11-15)

CreateLaunchTemplateVersion

Creates a new version for a launch template. You can specify an existing version of launch template from which to base the new version.

Launch template versions are numbered in the order in which they are created. You cannot specify, change, or replace the numbering of launch template versions.

Request Parameters

The following parameters are for this specific action. For more information about required and optional parameters that are common to all actions, see Common Query Parameters.

ClientToken

Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see Ensuring Idempotency.

Type: String

Required: No

DryRun

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Type: Boolean

Required: No

LaunchTemplateData

The information for the launch template.

Type: RequestLaunchTemplateData object

Required: Yes

LaunchTemplateId

The ID of the launch template. You must specify either the launch template ID or launch template name in the request.

Type: String

Required: No

LaunchTemplateName

The name of the launch template. You must specify either the launch template ID or launch template name in the request.

Type: String

Length Constraints: Minimum length of 3. Maximum length of 128.

Pattern: [a-zA-Z0-9\(\)\.-/_]+

Required: No

SourceVersion

The version number of the launch template version on which to base the new version. The new version inherits the same launch parameters as the source version, except for parameters that you specify in LaunchTemplateData.

Type: String

Required: No

VersionDescription

A description for the version of the launch template.

Type: String

Length Constraints: Maximum length of 255.

Required: No

Response Elements

The following elements are returned by the service.

launchTemplateVersion

Information about the launch template version.

Type: LaunchTemplateVersion object

requestId

The ID of the request.

Type: String

Errors

For information about the errors that are common to all actions, see Common Client Errors.

Example

Example

The following example creates a new launch template version for launch template MyLaunchTemplate and uses version 2 of the launch template as the base for the new version. The new launch template uses ami-aabbccdd. All other launch template data is inherited from the source version.

Sample Request

https://ec2.amazonaws.com/?Action=CreateLaunchTemplate &SourceVersion=2 &LaunchTemplateName=MyLaunchTemplate &VersionDescription=VersionWithNewAMI &LaunchTemplateData.ImageId=ami-aabbccdd &AUTHPARAMS

Sample Response

<CreateLaunchTemplateVersionResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/"> <requestId>6657423a-2616-461a-9ce5-3c65example</requestId> <launchTemplateVersion> <createTime>2017-10-31T11:56:00.000Z</createTime> <createdBy>arn:aws:iam::123456789012:root</createdBy> <defaultVersion>false</defaultVersion> <launchTemplateData> <imageId>ami-aabbccdd</imageId> <instanceType>t2.micro</instanceType> </launchTemplateData> <launchTemplateId>lt-0a20c965061f6454a</launchTemplateId> <launchTemplateName>MyLaunchTemplate</launchTemplateName> <versionDescription>VersionWithNewAMI</versionDescription> <versionNumber>4</versionNumber> </launchTemplateVersion> </CreateLaunchTemplateVersionResponse>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: