AWS SDK Version 3 for .NET
API Reference

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.

Container for the parameters to the CreateLaunchTemplate operation. 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 EC2 User Guide.

To clone an existing launch template as the basis for a new launch template, 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 EC2 User Guide.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.EC2.AmazonEC2Request
      Amazon.EC2.Model.CreateLaunchTemplateRequest

Namespace: Amazon.EC2.Model
Assembly: AWSSDK.EC2.dll
Version: 3.x.y.z

Syntax

C#
public class CreateLaunchTemplateRequest : AmazonEC2Request
         IAmazonWebServiceRequest

The CreateLaunchTemplateRequest type exposes the following members

Constructors

Properties

NameTypeDescription
Public Property ClientToken System.String

Gets and sets the property 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.

Public Property LaunchTemplateData Amazon.EC2.Model.RequestLaunchTemplateData

Gets and sets the property LaunchTemplateData.

The information for the launch template.

Public Property LaunchTemplateName System.String

Gets and sets the property LaunchTemplateName.

A name for the launch template.

Public Property TagSpecifications System.Collections.Generic.List<Amazon.EC2.Model.TagSpecification>

Gets and sets the property TagSpecifications.

The tags to apply to the launch template on creation. To tag the launch template, the resource type must be launch-template.

To specify the tags for the resources that are created when an instance is launched, you must use the TagSpecifications parameter in the launch template data structure.

Public Property VersionDescription System.String

Gets and sets the property VersionDescription.

A description for the first version of the launch template.

Examples

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.

To create a launch template


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;

            

Version Information

.NET:
Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5 and newer, 3.5