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.

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.

Note:

For .NET Core and PCL this operation is only available in asynchronous form. Please refer to CreateLaunchTemplateAsync.

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

Syntax

C#
public virtual CreateLaunchTemplateResponse CreateLaunchTemplate(
         CreateLaunchTemplateRequest request
)
Parameters
request
Type: Amazon.EC2.Model.CreateLaunchTemplateRequest

Container for the necessary parameters to execute the CreateLaunchTemplate service method.

Return Value
The response from the CreateLaunchTemplate service method, as returned by EC2.

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 response = client.CreateLaunchTemplate(new CreateLaunchTemplateRequest 
{
    LaunchTemplateData = new RequestLaunchTemplateData {
        ImageId = "ami-8c1be5f6",
        InstanceType = "t2.small",
        NetworkInterfaces = new List {
            new LaunchTemplateInstanceNetworkInterfaceSpecificationRequest {
                AssociatePublicIpAddress = true,
                DeviceIndex = 0,
                Ipv6AddressCount = 1,
                SubnetId = "subnet-7b16de0c"
            }
        },
        TagSpecifications = new List {
            new LaunchTemplateTagSpecificationRequest {
                ResourceType = "instance",
                Tags = new List {
                    new Tag {
                        Key = "Name",
                        Value = "webserver"
                    }
                }
            }
        }
    },
    LaunchTemplateName = "my-template",
    VersionDescription = "WebVersion1"
});

LaunchTemplate launchTemplate = response.LaunchTemplate;

            

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms

See Also