AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Creates a launch template.
A launch template contains the parameters to launch an instance. When you launch an instance using RunInstances, you can specify a launch template instead of providing the launch parameters in the request. For more information, see Launch an instance from a launch template in the Amazon Elastic Compute Cloud User Guide.
If you want to clone an existing launch template as the basis for creating a new launch template, you can use the Amazon EC2 console. The API, SDKs, and CLI do not support cloning a template. For more information, see Create a launch template from an existing launch template in the Amazon Elastic Compute Cloud User Guide.
For .NET Core this operation is only available in asynchronous form. Please refer to CreateLaunchTemplateAsync.
Namespace: Amazon.EC2
Assembly: AWSSDK.EC2.dll
Version: 3.x.y.z
public virtual CreateLaunchTemplateResponse CreateLaunchTemplate( CreateLaunchTemplateRequest request )
Container for the necessary parameters to execute the CreateLaunchTemplate service method.
This example creates a launch template that specifies the subnet in which to launch the instance, assigns a public IP address and an IPv6 address to the instance, and creates a tag for the instance.
var client = new AmazonEC2Client(); var response = client.CreateLaunchTemplate(new CreateLaunchTemplateRequest { LaunchTemplateData = new RequestLaunchTemplateData { ImageId = "ami-8c1be5f6", InstanceType = "t2.small", NetworkInterfaces = new List<LaunchTemplateInstanceNetworkInterfaceSpecificationRequest> { new LaunchTemplateInstanceNetworkInterfaceSpecificationRequest { AssociatePublicIpAddress = true, DeviceIndex = 0, Ipv6AddressCount = 1, SubnetId = "subnet-7b16de0c" } }, TagSpecifications = new List<LaunchTemplateTagSpecificationRequest> { new LaunchTemplateTagSpecificationRequest { ResourceType = "instance", Tags = new List<Tag> { new Tag { Key = "Name", Value = "webserver" } } } } }, LaunchTemplateName = "my-template", VersionDescription = "WebVersion1" }); LaunchTemplate launchTemplate = response.LaunchTemplate;
.NET Framework:
Supported in: 4.5, 4.0, 3.5