createLaunchTemplateVersion
inline suspend fun Ec2Client.createLaunchTemplateVersion(crossinline block: CreateLaunchTemplateVersionRequest.Builder.() -> Unit): CreateLaunchTemplateVersionResponse
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.
Samples
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
}