Skip to main content

launch_templates

Creates, updates, deletes, gets or lists a launch_templates resource.

Overview

Namelaunch_templates
TypeResource
Idaws.ec2.launch_templates

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
create_timestringThe time launch template was created.
created_bystringThe principal that created the launch template.
default_version_numberintegerThe version number of the default version of the launch template.
latest_version_numberintegerThe version number of the latest version of the launch template.
launch_template_idstringThe ID of the launch template.
launch_template_namestringThe name of the launch template.
operatorstringThe entity that manages the launch template.
tagsstringThe tags for the launch template.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_launch_templatesselectregionDryRun, LaunchTemplateId, LaunchTemplateName, Filter, NextToken, MaxResults, IncludeManagedResourcesDescribes one or more launch templates.
create_launch_templateinsertLaunchTemplateName, LaunchTemplateData, regionDryRun, ClientToken, VersionDescription, Operator, TagSpecificationCreates 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 Store instance launch parameters in Amazon EC2 launch templates 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.
modify_launch_templateupdateregionDryRun, ClientToken, LaunchTemplateId, LaunchTemplateName, SetDefaultVersionModifies a launch template. You can specify which version of the launch template to set as the default version. When launching an instance, the default version applies when a launch template version is not specified.
delete_launch_templatedeleteregionDryRun, LaunchTemplateId, LaunchTemplateNameDeletes a launch template. Deleting a launch template deletes all of its versions.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
LaunchTemplateDataobjectThe information for the launch template.
LaunchTemplateNamestringA name for the launch template.
regionstringAWS region (default: us-east-1)
ClientTokenstringUnique, case-sensitive identifier you provide to ensure the idempotency of the request. If a client token isn't specified, a randomly generated token is used in the request to ensure idempotency. For more information, see Ensuring idempotency. Constraint: Maximum 128 ASCII characters.
DryRunbooleanChecks 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.
FilterarrayOne or more filters. create-time - The time the launch template was created. launch-template-name - The name of the launch template. tag:<key> - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key Owner and the value TeamA, specify tag:Owner for the filter name and TeamA for the filter value. tag-key - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.
IncludeManagedResourcesbooleanIndicates whether to include managed resources in the output. If this parameter is set to true, the output includes resources that are managed by Amazon Web Services services, even if managed resource visibility is set to hidden.
LaunchTemplateIdstringThe ID of the launch template. You must specify either the launch template ID or the launch template name, but not both.
LaunchTemplateNamestringThe name of the launch template. You must specify either the launch template ID or the launch template name, but not both.
MaxResultsintegerThe maximum number of results to return in a single call. To retrieve the remaining results, make another call with the returned NextToken value. This value can be between 1 and 200.
NextTokenstringThe token to request the next page of results.
OperatorobjectReserved for internal use.
SetDefaultVersionstringThe version number of the launch template to set as the default version.
TagSpecificationarrayThe 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.
VersionDescriptionstringA description for the first version of the launch template.

SELECT examples

Describes one or more launch templates.

SELECT
create_time,
created_by,
default_version_number,
latest_version_number,
launch_template_id,
launch_template_name,
operator,
tags
FROM aws.ec2.launch_templates
WHERE region = '{{ region }}' -- required
AND DryRun = '{{ DryRun }}'
AND LaunchTemplateId = '{{ LaunchTemplateId }}'
AND LaunchTemplateName = '{{ LaunchTemplateName }}'
AND Filter = '{{ Filter }}'
AND NextToken = '{{ NextToken }}'
AND MaxResults = '{{ MaxResults }}'
AND IncludeManagedResources = '{{ IncludeManagedResources }}'
;

INSERT examples

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 Store instance launch parameters in Amazon EC2 launch templates 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.

INSERT INTO aws.ec2.launch_templates (
LaunchTemplateName,
LaunchTemplateData,
region,
DryRun,
ClientToken,
VersionDescription,
Operator,
TagSpecification
)
SELECT
'{{ LaunchTemplateName }}',
'{{ LaunchTemplateData }}',
'{{ region }}',
'{{ DryRun }}',
'{{ ClientToken }}',
'{{ VersionDescription }}',
'{{ Operator }}',
'{{ TagSpecification }}'
RETURNING
create_time,
created_by,
default_version_number,
latest_version_number,
launch_template_id,
launch_template_name,
operator,
tags
;

UPDATE examples

Modifies a launch template. You can specify which version of the launch template to set as the default version. When launching an instance, the default version applies when a launch template version is not specified.

UPDATE aws.ec2.launch_templates
SET
-- No updatable properties
WHERE
region = '{{ region }}' --required
AND DryRun = {{ DryRun}}
AND ClientToken = '{{ ClientToken}}'
AND LaunchTemplateId = '{{ LaunchTemplateId}}'
AND LaunchTemplateName = '{{ LaunchTemplateName}}'
AND SetDefaultVersion = '{{ SetDefaultVersion}}'
RETURNING
create_time,
created_by,
default_version_number,
latest_version_number,
launch_template_id,
launch_template_name,
operator,
tags;

DELETE examples

Deletes a launch template. Deleting a launch template deletes all of its versions.

DELETE FROM aws.ec2.launch_templates
WHERE region = '{{ region }}' --required
AND DryRun = '{{ DryRun }}'
AND LaunchTemplateId = '{{ LaunchTemplateId }}'
AND LaunchTemplateName = '{{ LaunchTemplateName }}'
;