CreateLaunchTemplate - Amazon Elastic Compute Cloud
AWS services or capabilities described in AWS documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with AWS services in China.


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 Launching an instance from a launch templatein the Amazon Elastic Compute Cloud User Guide.

Request Parameters

The following parameters are for this specific action. For more information about required and optional parameters that are common to all actions, see Common Query Parameters.


Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see Ensuring Idempotency.

Constraint: Maximum 128 ASCII characters.

Type: String

Required: No


Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Type: Boolean

Required: No


The information for the launch template.

Type: RequestLaunchTemplateData object

Required: Yes


A name for the launch template.

Type: String

Length Constraints: Minimum length of 3. Maximum length of 128.

Pattern: [a-zA-Z0-9\(\)\.\-/_]+

Required: Yes


The tags to apply to the launch template during creation.

Type: Array of TagSpecification objects

Required: No


A description for the first version of the launch template.

Type: String

Length Constraints: Maximum length of 255.

Required: No

Response Elements

The following elements are returned by the service.


Information about the launch template.

Type: LaunchTemplate object


The ID of the request.

Type: String


If the launch template contains parameters or parameter combinations that are not valid, an error code and an error message are returned for each issue that's found.

Type: ValidationWarning object


For information about the errors that are common to all actions, see Common Client Errors.


Example 1

The following example creates a launch template that specifies AMI ami-1a2b3c4d and an instance type of t2.micro.

Sample Request &LaunchTemplateName=MyLaunchTemplate &VersionDescription=FirstVersion &LaunchTemplateData.ImageId=ami-1a2b3c4d &LaunchTemplateData.InstanceType=t2.micro &AUTHPARAMS

Sample Response

<CreateLaunchTemplateResponse xmlns=""> <requestId>39f602bc-7580-4239-a6d8-af56example</requestId> <launchTemplate> <createTime>2017-10-31T11:38:52.000Z</createTime> <createdBy>arn:aws:iam::123456789012:root</createdBy> <defaultVersionNumber>1</defaultVersionNumber> <latestVersionNumber>1</latestVersionNumber> <launchTemplateId>lt-0a20c965061f64abc</launchTemplateId> <launchTemplateName>MyLaunchTemplate</launchTemplateName> </launchTemplate> </CreateLaunchTemplateResponse>

Example 2

The following example creates a launch template that specifies the subnet in which to launch the instance (subnet-7b16de0c), assigns a public IP address and an IPv6 address to the instance, and creates a tag for the instance (Name=webserver).

Sample Request &LaunchTemplateName=TemplateForWebServer &VersionDescription=WebVersion1 &LaunchTemplateData.ImageId=ami-8c1be5f6 &LaunchTemplateData.InstanceType=t2.micro &LaunchTemplateData.NetworkInterface.1.AssociatePublicIpAddress=true &LaunchTemplateData.NetworkInterface.1.DeviceIndex=0 &LaunchTemplateData.NetworkInterface.1.SubnetId=subnet-7b16de0c &LaunchTemplateData.NetworkInterface.1.Ipv6AddressCount=1 &LaunchTemplateData.TagSpecification.1.ResourceType=instance &LaunchTemplateData.TagSpecification.1.Tag.1.Key=Name &LaunchTemplateData.TagSpecification.1.Tag.1.Value=webserver &AUTHPARAMS

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: