:doc:`EC2 <../../ec2>` / Client / modify_launch_template

**********************
modify_launch_template
**********************



.. py:method:: 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 <https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyLaunchTemplate>`_  


  **Request Syntax**
  ::

    response = client.modify_launch_template(
        DryRun=True|False,
        ClientToken='string',
        LaunchTemplateId='string',
        LaunchTemplateName='string',
        DefaultVersion='string'
    )
    
  :type DryRun: boolean
  :param DryRun: 

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

    

  
  :type ClientToken: string
  :param ClientToken: 

    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 <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html>`__.

     

    Constraint: Maximum 128 ASCII characters.

    This field is autopopulated if not provided.

  
  :type LaunchTemplateId: string
  :param LaunchTemplateId: 

    The ID of the launch template.

     

    You must specify either the launch template ID or the launch template name, but not both.

    

  
  :type LaunchTemplateName: string
  :param LaunchTemplateName: 

    The name of the launch template.

     

    You must specify either the launch template ID or the launch template name, but not both.

    

  
  :type DefaultVersion: string
  :param DefaultVersion: 

    The version number of the launch template to set as the default version.

    

  
  
  :rtype: 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 a service provider.

            
          

          - **Principal** *(string) --* 

            If ``managed`` is ``true``, then the principal is returned. The principal is the service provider 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': {
            '...': '...',
        },
    }

  