CreateLaunchTemplateVersion
Creates a new version of 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.
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.
For more information, see Modify a launch template (manage launch template versions) in the Amazon Elastic Compute Cloud User Guide.
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.
Constraint: Maximum 128 ASCII characters.
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 isUnauthorizedOperation
.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
LaunchTemplateId
or theLaunchTemplateName
, but not both.Type: String
Required: No
- LaunchTemplateName
-
The name of the launch template.
You must specify the
LaunchTemplateName
or theLaunchTemplateId
, but not both.Type: String
Length Constraints: Minimum length of 3. Maximum length of 128.
Pattern:
[a-zA-Z0-9\(\)\.\-/_]+
Required: No
- ResolveAlias
-
If
true
, and if a Systems Manager parameter is specified forImageId
, the AMI ID is displayed in the response forimageID
. For more information, see Use a Systems Manager parameter instead of an AMI ID in the Amazon Elastic Compute Cloud User Guide.Default:
false
Type: Boolean
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
. Snapshots applied to the block device mapping are ignored when creating a new version unless they are explicitly included.Type: String
Required: No
- VersionDescription
-
A description for the version of the launch template.
Type: String
Length Constraints: Minimum length of 0. 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
- warning
-
If the new version of the launch template contains parameters or parameter combinations that are not valid, an error code and an error message are returned for each issue that's found.
Type: ValidationWarning object
Errors
For information about the errors that are common to all actions, see Common client error codes.
Examples
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 Amazon SDKs, see the following: