launch_templates
Creates, updates, deletes, gets or lists a launch_templates resource.
Overview
| Name | launch_templates |
| Type | Resource |
| Id | aws.ec2.launch_templates |
Fields
The following fields are returned by SELECT queries:
- describe_launch_templates
| Name | Datatype | Description |
|---|---|---|
create_time | string | The time launch template was created. |
created_by | string | The principal that created the launch template. |
default_version_number | integer | The version number of the default version of the launch template. |
latest_version_number | integer | The version number of the latest version of the launch template. |
launch_template_id | string | The ID of the launch template. |
launch_template_name | string | The name of the launch template. |
operator | string | The entity that manages the launch template. |
tags | string | The tags for the launch template. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_launch_templates | select | region | DryRun, LaunchTemplateId, LaunchTemplateName, Filter, NextToken, MaxResults, IncludeManagedResources | Describes one or more launch templates. |
create_launch_template | insert | LaunchTemplateName, LaunchTemplateData, region | DryRun, ClientToken, VersionDescription, Operator, TagSpecification | 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. |
modify_launch_template | update | region | DryRun, ClientToken, LaunchTemplateId, LaunchTemplateName, SetDefaultVersion | 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. |
delete_launch_template | delete | region | DryRun, LaunchTemplateId, LaunchTemplateName | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
LaunchTemplateData | object | The information for the launch template. |
LaunchTemplateName | string | A name for the launch template. |
region | string | AWS region (default: us-east-1) |
ClientToken | string | Unique, 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. |
DryRun | boolean | 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. |
Filter | array | One 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. |
IncludeManagedResources | boolean | Indicates 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. |
LaunchTemplateId | string | The ID of the launch template. You must specify either the launch template ID or the launch template name, but not both. |
LaunchTemplateName | string | The name of the launch template. You must specify either the launch template ID or the launch template name, but not both. |
MaxResults | integer | The 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. |
NextToken | string | The token to request the next page of results. |
Operator | object | Reserved for internal use. |
SetDefaultVersion | string | The version number of the launch template to set as the default version. |
TagSpecification | array | 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. |
VersionDescription | string | A description for the first version of the launch template. |
SELECT examples
- describe_launch_templates
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
- create_launch_template
- Manifest
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
;
# Description fields are for documentation purposes
- name: launch_templates
props:
- name: LaunchTemplateName
value: "{{ LaunchTemplateName }}"
description: Required parameter for the launch_templates resource.
- name: LaunchTemplateData
value: "{{ LaunchTemplateData }}"
description: Required parameter for the launch_templates resource.
- name: region
value: "{{ region }}"
description: Required parameter for the launch_templates resource.
- name: DryRun
value: {{ DryRun }}
description: 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.
description: 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.
- name: ClientToken
value: "{{ ClientToken }}"
description: Unique, 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.
description: Unique, 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.
- name: VersionDescription
value: "{{ VersionDescription }}"
description: A description for the first version of the launch template.
description: A description for the first version of the launch template.
- name: Operator
value: "{{ Operator }}"
description: Reserved for internal use.
description: Reserved for internal use.
- name: TagSpecification
value: "{{ TagSpecification }}"
description: 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.
description: 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.
UPDATE examples
- modify_launch_template
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
- delete_launch_template
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 }}'
;