delete_launch_template_versions

EC2.Client.delete_launch_template_versions(**kwargs)

Deletes one or more versions of a launch template. You cannot 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.

See also: AWS API Documentation

Request Syntax

response = client.delete_launch_template_versions(
    DryRun=True|False,
    LaunchTemplateId='string',
    LaunchTemplateName='string',
    Versions=[
        'string',
    ]
)
Parameters
  • 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 .
  • LaunchTemplateId (string) --

    The ID of the launch template.

    You must specify either the LaunchTemplateId or the LaunchTemplateName , but not both.

  • LaunchTemplateName (string) --

    The name of the launch template.

    You must specify either the LaunchTemplateName or the LaunchTemplateId , but not both.

  • Versions (list) --

    [REQUIRED]

    The version numbers of one or more launch template versions to delete.

    • (string) --
Return type

dict

Returns

Response Syntax

{
    'SuccessfullyDeletedLaunchTemplateVersions': [
        {
            'LaunchTemplateId': 'string',
            'LaunchTemplateName': 'string',
            'VersionNumber': 123
        },
    ],
    'UnsuccessfullyDeletedLaunchTemplateVersions': [
        {
            'LaunchTemplateId': 'string',
            'LaunchTemplateName': 'string',
            'VersionNumber': 123,
            'ResponseError': {
                'Code': 'launchTemplateIdDoesNotExist'|'launchTemplateIdMalformed'|'launchTemplateNameDoesNotExist'|'launchTemplateNameMalformed'|'launchTemplateVersionDoesNotExist'|'unexpectedError',
                'Message': 'string'
            }
        },
    ]
}

Response Structure

  • (dict) --

    • SuccessfullyDeletedLaunchTemplateVersions (list) --

      Information about the launch template versions that were successfully deleted.

      • (dict) --

        Describes a launch template version that was successfully deleted.

        • LaunchTemplateId (string) --

          The ID of the launch template.

        • LaunchTemplateName (string) --

          The name of the launch template.

        • VersionNumber (integer) --

          The version number of the launch template.

    • UnsuccessfullyDeletedLaunchTemplateVersions (list) --

      Information about the launch template versions that could not be deleted.

      • (dict) --

        Describes a launch template version that could not be deleted.

        • LaunchTemplateId (string) --

          The ID of the launch template.

        • LaunchTemplateName (string) --

          The name of the launch template.

        • VersionNumber (integer) --

          The version number of the launch template.

        • ResponseError (dict) --

          Information about the error.

          • Code (string) --

            The error code.

          • Message (string) --

            The error message, if applicable.

Examples

This example deletes the specified launch template version.

response = client.delete_launch_template_versions(
    LaunchTemplateId='lt-0abcd290751193123',
    Versions=[
        '1',
    ],
)

print(response)

Expected Output:

{
    'SuccessfullyDeletedLaunchTemplateVersions': [
        {
            'LaunchTemplateId': 'lt-0abcd290751193123',
            'LaunchTemplateName': 'my-template',
            'VersionNumber': 1,
        },
    ],
    'UnsuccessfullyDeletedLaunchTemplateVersions': [
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}