launch_template_versions
Creates, updates, deletes, gets or lists a launch_template_versions resource.
Overview
| Name | launch_template_versions |
| Type | Resource |
| Id | aws.ec2.launch_template_versions |
Fields
The following fields are returned by SELECT queries:
- describe_launch_template_versions
| Name | Datatype | Description |
|---|---|---|
create_time | string | The time the version was created. |
created_by | string | The principal that created the version. |
default_version | boolean | Indicates whether the version is the default version. |
launch_template_data | string | Information about 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. |
version_description | string | The description for the version. |
version_number | integer | The version number. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_launch_template_versions | select | region | DryRun, LaunchTemplateId, LaunchTemplateName, LaunchTemplateVersion, MinVersion, MaxVersion, NextToken, MaxResults, Filter, ResolveAlias, IncludeManagedResources | Describes one or more versions of a specified launch template. You can describe all versions, individual versions, or a range of versions. You can also describe all the latest versions or all the default versions of all the launch templates in your account. |
create_launch_template_version | insert | LaunchTemplateData, region | DryRun, ClientToken, LaunchTemplateId, LaunchTemplateName, SourceVersion, VersionDescription, ResolveAlias | Creates a new version of a launch template. You must specify an existing launch template, either by name or ID. You can determine whether the new version inherits parameters from a source version, and add or overwrite parameters as needed. Launch template versions are numbered in the order in which they are created. You can't specify, change, or replace the numbering of launch template versions. Launch templates are immutable; after you create a launch template, you can't modify it. Instead, you can create a new version of the launch template that includes the changes that you require. For more information, see Modify a launch template (manage launch template versions) in the Amazon EC2 User Guide. |
delete_launch_template_versions | delete | LaunchTemplateVersion, region | DryRun, LaunchTemplateId, LaunchTemplateName | Deletes one or more versions of a launch template. You can't delete the default version of a launch template; you must first assign a different version as the default. If the default version is the only version for the launch template, you must delete the entire launch template using DeleteLaunchTemplate. You can delete up to 200 launch template versions in a single request. To delete more than 200 versions in a single request, use DeleteLaunchTemplate, which deletes the launch template and all of its versions. For more information, see Delete a launch template version in the Amazon EC2 User Guide. |
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. |
LaunchTemplateVersion | array | The version numbers of one or more launch template versions to delete. You can specify up to 200 launch template version numbers. |
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 version was created. ebs-optimized - A boolean that indicates whether the instance is optimized for Amazon EBS I/O. http-endpoint - Indicates whether the HTTP metadata endpoint on your instances is enabled (enabled | disabled). http-protocol-ipv4 - Indicates whether the IPv4 endpoint for the instance metadata service is enabled (enabled | disabled). host-resource-group-arn - The ARN of the host resource group in which to launch the instances. http-tokens - The state of token usage for your instance metadata requests (optional | required). iam-instance-profile - The ARN of the IAM instance profile. image-id - The ID of the AMI. instance-type - The instance type. is-default-version - A boolean that indicates whether the launch template version is the default version. kernel-id - The kernel ID. license-configuration-arn - The ARN of the license configuration. network-card-index - The index of the network card. ram-disk-id - The RAM disk ID. |
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. |
LaunchTemplateVersion | array | One or more versions of the launch template. Valid values depend on whether you are describing a specified launch template (by ID or name) or all launch templates in your account. To describe one or more versions of a specified launch template, valid values are $Latest, $Default, and numbers. To describe all launch templates in your account that are defined as the latest version, the valid value is $Latest. To describe all launch templates in your account that are defined as the default version, the valid value is $Default. You can specify $Latest and $Default in the same request. You cannot specify numbers. |
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. |
MaxVersion | string | The version number up to which to describe launch template versions. |
MinVersion | string | The version number after which to describe launch template versions. |
NextToken | string | The token to request the next page of results. |
ResolveAlias | boolean | If true, and if a Systems Manager parameter is specified for ImageId, the AMI ID is displayed in the response for imageID. For more information, see Use a Systems Manager parameter instead of an AMI ID in the Amazon EC2 User Guide. Default: false |
SourceVersion | string | The version of the launch template on which to base the new version. Snapshots applied to the block device mapping are ignored when creating a new version unless they are explicitly included. If you specify this parameter, the new version inherits the launch parameters from the source version. If you specify additional launch parameters for the new version, they overwrite any corresponding launch parameters inherited from the source version. If you omit this parameter, the new version contains only the launch parameters that you specify for the new version. |
VersionDescription | string | A description for the version of the launch template. |
SELECT examples
- describe_launch_template_versions
Describes one or more versions of a specified launch template. You can describe all versions, individual versions, or a range of versions. You can also describe all the latest versions or all the default versions of all the launch templates in your account.
SELECT
create_time,
created_by,
default_version,
launch_template_data,
launch_template_id,
launch_template_name,
operator,
version_description,
version_number
FROM aws.ec2.launch_template_versions
WHERE region = '{{ region }}' -- required
AND DryRun = '{{ DryRun }}'
AND LaunchTemplateId = '{{ LaunchTemplateId }}'
AND LaunchTemplateName = '{{ LaunchTemplateName }}'
AND LaunchTemplateVersion = '{{ LaunchTemplateVersion }}'
AND MinVersion = '{{ MinVersion }}'
AND MaxVersion = '{{ MaxVersion }}'
AND NextToken = '{{ NextToken }}'
AND MaxResults = '{{ MaxResults }}'
AND Filter = '{{ Filter }}'
AND ResolveAlias = '{{ ResolveAlias }}'
AND IncludeManagedResources = '{{ IncludeManagedResources }}'
;
INSERT examples
- create_launch_template_version
- Manifest
Creates a new version of a launch template. You must specify an existing launch template, either by name or ID. You can determine whether the new version inherits parameters from a source version, and add or overwrite parameters as needed. Launch template versions are numbered in the order in which they are created. You can't specify, change, or replace the numbering of launch template versions. Launch templates are immutable; after you create a launch template, you can't modify it. Instead, you can create a new version of the launch template that includes the changes that you require. For more information, see Modify a launch template (manage launch template versions) in the Amazon EC2 User Guide.
INSERT INTO aws.ec2.launch_template_versions (
LaunchTemplateData,
region,
DryRun,
ClientToken,
LaunchTemplateId,
LaunchTemplateName,
SourceVersion,
VersionDescription,
ResolveAlias
)
SELECT
'{{ LaunchTemplateData }}',
'{{ region }}',
'{{ DryRun }}',
'{{ ClientToken }}',
'{{ LaunchTemplateId }}',
'{{ LaunchTemplateName }}',
'{{ SourceVersion }}',
'{{ VersionDescription }}',
'{{ ResolveAlias }}'
RETURNING
create_time,
created_by,
default_version,
launch_template_data,
launch_template_id,
launch_template_name,
operator,
version_description,
version_number
;
# Description fields are for documentation purposes
- name: launch_template_versions
props:
- name: LaunchTemplateData
value: "{{ LaunchTemplateData }}"
description: Required parameter for the launch_template_versions resource.
- name: region
value: "{{ region }}"
description: Required parameter for the launch_template_versions 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: LaunchTemplateId
value: "{{ LaunchTemplateId }}"
description: The ID of the launch template. You must specify either the launch template ID or the launch template name, but not both.
description: The ID of the launch template. You must specify either the launch template ID or the launch template name, but not both.
- name: LaunchTemplateName
value: "{{ LaunchTemplateName }}"
description: The name of the launch template. You must specify either the launch template ID or the launch template name, but not both.
description: The name of the launch template. You must specify either the launch template ID or the launch template name, but not both.
- name: SourceVersion
value: "{{ SourceVersion }}"
description: The version of the launch template on which to base the new version. Snapshots applied to the block device mapping are ignored when creating a new version unless they are explicitly included. If you specify this parameter, the new version inherits the launch parameters from the source version. If you specify additional launch parameters for the new version, they overwrite any corresponding launch parameters inherited from the source version. If you omit this parameter, the new version contains only the launch parameters that you specify for the new version.
description: The version of the launch template on which to base the new version. Snapshots applied to the block device mapping are ignored when creating a new version unless they are explicitly included. If you specify this parameter, the new version inherits the launch parameters from the source version. If you specify additional launch parameters for the new version, they overwrite any corresponding launch parameters inherited from the source version. If you omit this parameter, the new version contains only the launch parameters that you specify for the new version.
- name: VersionDescription
value: "{{ VersionDescription }}"
description: A description for the version of the launch template.
description: A description for the version of the launch template.
- name: ResolveAlias
value: {{ ResolveAlias }}
description: If true, and if a Systems Manager parameter is specified for ImageId, the AMI ID is displayed in the response for imageID. For more information, see Use a Systems Manager parameter instead of an AMI ID in the Amazon EC2 User Guide. Default: false
description: If true, and if a Systems Manager parameter is specified for ImageId, the AMI ID is displayed in the response for imageID. For more information, see Use a Systems Manager parameter instead of an AMI ID in the Amazon EC2 User Guide. Default: false
DELETE examples
- delete_launch_template_versions
Deletes one or more versions of a launch template. You can't delete the default version of a launch template; you must first assign a different version as the default. If the default version is the only version for the launch template, you must delete the entire launch template using DeleteLaunchTemplate. You can delete up to 200 launch template versions in a single request. To delete more than 200 versions in a single request, use DeleteLaunchTemplate, which deletes the launch template and all of its versions. For more information, see Delete a launch template version in the Amazon EC2 User Guide.
DELETE FROM aws.ec2.launch_template_versions
WHERE LaunchTemplateVersion = '{{ LaunchTemplateVersion }}' --required
AND region = '{{ region }}' --required
AND DryRun = '{{ DryRun }}'
AND LaunchTemplateId = '{{ LaunchTemplateId }}'
AND LaunchTemplateName = '{{ LaunchTemplateName }}'
;