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

*********************************
modify_instance_metadata_defaults
*********************************



.. py:method:: EC2.Client.modify_instance_metadata_defaults(**kwargs)

  

  Modifies the default instance metadata service (IMDS) settings at the account level in the specified Amazon Web Services Region.

   

  .. note::

    

    To remove a parameter's account-level default setting, specify ``no-preference``. If an account-level setting is cleared with ``no-preference``, then the instance launch considers the other instance metadata settings. For more information, see `Order of precedence for instance metadata options <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-options.html#instance-metadata-options-order-of-precedence>`__ in the *Amazon EC2 User Guide*.

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyInstanceMetadataDefaults>`_  


  **Request Syntax**
  ::

    response = client.modify_instance_metadata_defaults(
        HttpTokens='optional'|'required'|'no-preference',
        HttpPutResponseHopLimit=123,
        HttpEndpoint='disabled'|'enabled'|'no-preference',
        InstanceMetadataTags='disabled'|'enabled'|'no-preference',
        DryRun=True|False
    )
    
  :type HttpTokens: string
  :param HttpTokens: 

    Indicates whether IMDSv2 is required.

     

    
    * ``optional`` – IMDSv2 is optional, which means that you can use either IMDSv2 or IMDSv1.
     
    * ``required`` – IMDSv2 is required, which means that IMDSv1 is disabled, and you must use IMDSv2.
    

    

  
  :type HttpPutResponseHopLimit: integer
  :param HttpPutResponseHopLimit: 

    The maximum number of hops that the metadata token can travel. To indicate no preference, specify ``-1``.

     

    Possible values: Integers from ``1`` to ``64``, and ``-1`` to indicate no preference

    

  
  :type HttpEndpoint: string
  :param HttpEndpoint: 

    Enables or disables the IMDS endpoint on an instance. When disabled, the instance metadata can't be accessed.

    

  
  :type InstanceMetadataTags: string
  :param InstanceMetadataTags: 

    Enables or disables access to an instance's tags from the instance metadata. For more information, see `View tags for your EC2 instances using instance metadata <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/work-with-tags-in-IMDS.html>`__ in the *Amazon EC2 User Guide*.

    

  
  :type DryRun: boolean
  :param DryRun: 

    Checks whether you have the required permissions for the operation, 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``.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'Return': True|False
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **Return** *(boolean) --* 

        If the request succeeds, the response returns ``true``. If the request fails, no response is returned, and instead an error message is returned.

        
  