createLaunchTemplateVersion
abstract suspend fun createLaunchTemplateVersion(input: CreateLaunchTemplateVersionRequest): CreateLaunchTemplateVersionResponse
Creates a new version of a launch template. You must specify an existing launch template, either by name or ID. You can determine whether the new version inherits parameters from a source version, and add or overwrite parameters as needed.
Launch template versions are numbered in the order in which they are created. You can't 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 the changes that you require.
For more information, see Modify a launch template (manage launch template versions) in the Amazon EC2 User Guide.
Samples
import aws.sdk.kotlin.services.ec2.model.RequestLaunchTemplateData
fun main() {
//sampleStart
// This example creates a new launch template version based on version 1 of the specified launch
// template and specifies a different AMI ID.
val resp = ec2Client.createLaunchTemplateVersion {
launchTemplateId = "lt-0abcd290751193123"
sourceVersion = "1"
versionDescription = "WebVersion2"
launchTemplateData = RequestLaunchTemplateData {
imageId = "ami-c998b6b2"
}
}
//sampleEnd
}