EC2 / Client / modify_launch_template

modify_launch_template#

EC2.Client.modify_launch_template(**kwargs)#

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.

See also: AWS API Documentation

Request Syntax

response = client.modify_launch_template(
    DryRun=True|False,
    ClientToken='string',
    LaunchTemplateId='string',
    LaunchTemplateName='string',
    DefaultVersion='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.

  • ClientToken (string) –

    Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see Ensuring idempotency.

    Constraint: Maximum 128 ASCII characters.

  • 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.

  • DefaultVersion (string) – The version number of the launch template to set as the default version.

Return type:

dict

Returns:

Response Syntax

{
    'LaunchTemplate': {
        'LaunchTemplateId': 'string',
        'LaunchTemplateName': 'string',
        'CreateTime': datetime(2015, 1, 1),
        'CreatedBy': 'string',
        'DefaultVersionNumber': 123,
        'LatestVersionNumber': 123,
        'Tags': [
            {
                'Key': 'string',
                'Value': 'string'
            },
        ],
        'Operator': {
            'Managed': True|False,
            'Principal': 'string'
        }
    }
}

Response Structure

  • (dict) –

    • LaunchTemplate (dict) –

      Information about the launch template.

      • LaunchTemplateId (string) –

        The ID of the launch template.

      • LaunchTemplateName (string) –

        The name of the launch template.

      • CreateTime (datetime) –

        The time launch template was created.

      • CreatedBy (string) –

        The principal that created the launch template.

      • DefaultVersionNumber (integer) –

        The version number of the default version of the launch template.

      • LatestVersionNumber (integer) –

        The version number of the latest version of the launch template.

      • Tags (list) –

        The tags for the launch template.

        • (dict) –

          Describes a tag.

          • Key (string) –

            The key of the tag.

            Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with aws:.

          • Value (string) –

            The value of the tag.

            Constraints: Tag values are case-sensitive and accept a maximum of 256 Unicode characters.

      • Operator (dict) –

        The entity that manages the launch template.

        • Managed (boolean) –

          If true, the resource is managed by an entity.

        • Principal (string) –

          If managed is true, then the principal is returned. The principal is the entity that manages the resource.

Examples

This example specifies version 2 as the default version of the specified launch template.

response = client.modify_launch_template(
    DefaultVersion='2',
    LaunchTemplateId='lt-0abcd290751193123',
)

print(response)

Expected Output:

{
    'LaunchTemplate': {
        'CreateTime': datetime(2017, 12, 1, 13, 35, 46, 4, 335, 0),
        'CreatedBy': 'arn:aws:iam::123456789012:root',
        'DefaultVersionNumber': 2,
        'LatestVersionNumber': 2,
        'LaunchTemplateId': 'lt-0abcd290751193123',
        'LaunchTemplateName': 'WebServers',
    },
    'ResponseMetadata': {
        '...': '...',
    },
}