Skip to content

describe_launch_template_versions async

describe_launch_template_versions(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    dry_run: Optional[Boolean] = None,
    launch_template_id: Optional[LaunchTemplateId] = None,
    launch_template_name: Optional[LaunchTemplateName] = None,
    versions: Optional[VersionStringList] = None,
    min_version: Optional[String] = None,
    max_version: Optional[String] = None,
    next_token: Optional[String] = None,
    max_results: Optional[Integer] = None,
    filters: Optional[FilterList] = None,
    resolve_alias: Optional[Boolean] = None,
    include_managed_resources: Optional[Boolean] = None,
) -> DescribeLaunchTemplateVersionsResult

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.

Parameters:

  • dry_run (Optional[Boolean], default: None ) –

    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.

  • launch_template_id (Optional[LaunchTemplateId], default: None ) –

    The ID of the launch template.

    To describe one or more versions of a specified launch template, you must specify either the launch template ID or the launch template name, but not both.

    To describe all the latest or default launch template versions in your account, you must omit this parameter.

  • launch_template_name (Optional[LaunchTemplateName], default: None ) –

    The name of the launch template.

    To describe one or more versions of a specified launch template, you must specify either the launch template name or the launch template ID, but not both.

    To describe all the latest or default launch template versions in your account, you must omit this parameter.

  • versions (Optional[VersionStringList], default: None ) –

    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.

  • min_version (Optional[String], default: None ) –

    The version number after which to describe launch template versions.

  • max_version (Optional[String], default: None ) –

    The version number up to which to describe launch template versions.

  • next_token (Optional[String], default: None ) –

    The token to request the next page of results.

  • max_results (Optional[Integer], default: None ) –

    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.

  • filters (Optional[FilterList], default: None ) –

    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.

  • resolve_alias (Optional[Boolean], default: None ) –

    If true, and if a Systems Manager parameter is specified for ImageId, the AMI ID is displayed in the response for imageId.

    If false, and if a Systems Manager parameter is specified for ImageId, the parameter 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

  • include_managed_resources (Optional[Boolean], default: None ) –

    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.

Raises:

Examples:

To describe the versions for a launch template This example describes the versions for the specified launch template.

>>> await client.describe_launch_template_versions(launch_template_id='068f72b72934aff71')
Source code in docs_src/capo_ec2/_services/async_ec2.py
async def describe_launch_template_versions(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    launch_template_id: Optional[
        "capo_ec2.types.launch_template_id.LaunchTemplateId"
    ] = None,
    launch_template_name: Optional[
        "capo_ec2.types.launch_template_name.LaunchTemplateName"
    ] = None,
    versions: Optional[
        "capo_ec2.types.version_string_list.VersionStringList"
    ] = None,
    min_version: Optional["capo_ec2.types.string.String"] = None,
    max_version: Optional["capo_ec2.types.string.String"] = None,
    next_token: Optional["capo_ec2.types.string.String"] = None,
    max_results: Optional["capo_ec2.types.integer.Integer"] = None,
    filters: Optional["capo_ec2.types.filter_list.FilterList"] = None,
    resolve_alias: Optional["capo_ec2.types.boolean.Boolean"] = None,
    include_managed_resources: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.describe_launch_template_versions_result.DescribeLaunchTemplateVersionsResult":
    """<p>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.</p>

    Args:
        dry_run: <p>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 <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
        launch_template_id: <p>The ID of the launch template.</p> <p>To describe one or more versions of a specified launch template, you must specify either the launch template ID or the launch template name, but not both.</p> <p>To describe all the latest or default launch template versions in your account, you must omit this parameter.</p>
        launch_template_name: <p>The name of the launch template.</p> <p>To describe one or more versions of a specified launch template, you must specify either the launch template name or the launch template ID, but not both.</p> <p>To describe all the latest or default launch template versions in your account, you must omit this parameter.</p>
        versions: <p>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.</p> <p>To describe one or more versions of a specified launch template, valid values are <code>$Latest</code>, <code>$Default</code>, and numbers.</p> <p>To describe all launch templates in your account that are defined as the latest version, the valid value is <code>$Latest</code>. To describe all launch templates in your account that are defined as the default version, the valid value is <code>$Default</code>. You can specify <code>$Latest</code> and <code>$Default</code> in the same request. You cannot specify numbers.</p>
        min_version: <p>The version number after which to describe launch template versions.</p>
        max_version: <p>The version number up to which to describe launch template versions.</p>
        next_token: <p>The token to request the next page of results.</p>
        max_results: <p>The maximum number of results to return in a single call. To retrieve the remaining results, make another call with the returned <code>NextToken</code> value. This value can be between 1 and 200.</p>
        filters: <p>One or more filters.</p> <ul> <li> <p> <code>create-time</code> - The time the launch template version was created.</p> </li> <li> <p> <code>ebs-optimized</code> - A boolean that indicates whether the instance is optimized for Amazon EBS I/O.</p> </li> <li> <p> <code>http-endpoint</code> - Indicates whether the HTTP metadata endpoint on your instances is enabled (<code>enabled</code> | <code>disabled</code>).</p> </li> <li> <p> <code>http-protocol-ipv4</code> - Indicates whether the IPv4 endpoint for the instance metadata service is enabled (<code>enabled</code> | <code>disabled</code>).</p> </li> <li> <p> <code>host-resource-group-arn</code> - The ARN of the host resource group in which to launch the instances.</p> </li> <li> <p> <code>http-tokens</code> - The state of token usage for your instance metadata requests (<code>optional</code> | <code>required</code>).</p> </li> <li> <p> <code>iam-instance-profile</code> - The ARN of the IAM instance profile.</p> </li> <li> <p> <code>image-id</code> - The ID of the AMI.</p> </li> <li> <p> <code>instance-type</code> - The instance type.</p> </li> <li> <p> <code>is-default-version</code> - A boolean that indicates whether the launch template version is the default version.</p> </li> <li> <p> <code>kernel-id</code> - The kernel ID.</p> </li> <li> <p> <code>license-configuration-arn</code> - The ARN of the license configuration.</p> </li> <li> <p> <code>network-card-index</code> - The index of the network card.</p> </li> <li> <p> <code>ram-disk-id</code> - The RAM disk ID.</p> </li> </ul>
        resolve_alias: <p>If <code>true</code>, and if a Systems Manager parameter is specified for <code>ImageId</code>, the AMI ID is displayed in the response for <code>imageId</code>.</p> <p>If <code>false</code>, and if a Systems Manager parameter is specified for <code>ImageId</code>, the parameter is displayed in the response for <code>imageId</code>.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-launch-template.html#use-an-ssm-parameter-instead-of-an-ami-id">Use a Systems Manager parameter instead of an AMI ID</a> in the <i>Amazon EC2 User Guide</i>.</p> <p>Default: <code>false</code> </p>
        include_managed_resources: <p>Indicates whether to include managed resources in the output. If this parameter is set to <code>true</code>, the output includes resources that are managed by Amazon Web Services services, even if managed resource visibility is set to hidden.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To describe the versions for a launch template
        This example describes the versions for the specified launch template.

        >>> await client.describe_launch_template_versions(launch_template_id='068f72b72934aff71')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.describe_launch_template_versions_request.DescribeLaunchTemplateVersionsRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.describe_launch_template_versions_result.DescribeLaunchTemplateVersionsResult"
    ]:
        import capo_ec2._operations.amazon_ec2.describe_launch_template_versions

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.describe_launch_template_versions.async_describe_launch_template_versions(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_ec2.types.describe_launch_template_versions_result.DescribeLaunchTemplateVersionsResult",
    ) -> dict[str, Any]:
        import capo_ec2.types.describe_launch_template_versions_result

        return capo_ec2.types.describe_launch_template_versions_result.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "DescribeLaunchTemplateVersions", redact_output=_redact_output
        ),
    )
    input_: capo_ec2.types.describe_launch_template_versions_request.DescribeLaunchTemplateVersionsRequest = {}
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if launch_template_id is not None:
        input_["launch_template_id"] = launch_template_id
    if launch_template_name is not None:
        input_["launch_template_name"] = launch_template_name
    if versions is not None:
        input_["versions"] = versions
    if min_version is not None:
        input_["min_version"] = min_version
    if max_version is not None:
        input_["max_version"] = max_version
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if filters is not None:
        input_["filters"] = filters
    if resolve_alias is not None:
        input_["resolve_alias"] = resolve_alias
    if include_managed_resources is not None:
        input_["include_managed_resources"] = include_managed_resources

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output