Skip to main content

launch_template_versions

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

Overview

Namelaunch_template_versions
TypeResource
Idaws.ec2.launch_template_versions

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
create_timestringThe time the version was created.
created_bystringThe principal that created the version.
default_versionbooleanIndicates whether the version is the default version.
launch_template_datastringInformation about 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.
version_descriptionstringThe description for the version.
version_numberintegerThe version number.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_launch_template_versionsselectregionDryRun, LaunchTemplateId, LaunchTemplateName, LaunchTemplateVersion, MinVersion, MaxVersion, NextToken, MaxResults, Filter, ResolveAlias, IncludeManagedResourcesDescribes 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_versioninsertLaunchTemplateData, regionDryRun, ClientToken, LaunchTemplateId, LaunchTemplateName, SourceVersion, VersionDescription, ResolveAliasCreates 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_versionsdeleteLaunchTemplateVersion, regionDryRun, LaunchTemplateId, LaunchTemplateNameDeletes 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.

NameDatatypeDescription
LaunchTemplateDataobjectThe information for the launch template.
LaunchTemplateVersionarrayThe version numbers of one or more launch template versions to delete. You can specify up to 200 launch template version numbers.
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 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.
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.
LaunchTemplateVersionarrayOne 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.
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.
MaxVersionstringThe version number up to which to describe launch template versions.
MinVersionstringThe version number after which to describe launch template versions.
NextTokenstringThe token to request the next page of results.
ResolveAliasbooleanIf 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
SourceVersionstringThe 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.
VersionDescriptionstringA description for the version of the launch template.

SELECT examples

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

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
;

DELETE examples

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 }}'
;