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

******************************
get_instance_metadata_defaults
******************************



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

  

  Gets the default instance metadata service (IMDS) settings that are set at the account level in the specified Amazon Web Services Region.

   

  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/GetInstanceMetadataDefaults>`_  


  **Request Syntax**
  ::

    response = client.get_instance_metadata_defaults(
        DryRun=True|False
    )
    
  :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**

    
    ::

      {
          'AccountLevel': {
              'HttpTokens': 'optional'|'required',
              'HttpPutResponseHopLimit': 123,
              'HttpEndpoint': 'disabled'|'enabled',
              'InstanceMetadataTags': 'disabled'|'enabled',
              'ManagedBy': 'account'|'declarative-policy',
              'ManagedExceptionMessage': 'string'
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **AccountLevel** *(dict) --* 

        The account-level default IMDS settings.

        
        

        - **HttpTokens** *(string) --* 

          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.
          

          
        

        - **HttpPutResponseHopLimit** *(integer) --* 

          The maximum number of hops that the metadata token can travel.

          
        

        - **HttpEndpoint** *(string) --* 

          Indicates whether the IMDS endpoint for an instance is enabled or disabled. When disabled, the instance metadata can't be accessed.

          
        

        - **InstanceMetadataTags** *(string) --* 

          Indicates whether access to instance tags from the instance metadata is enabled or disabled. 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*.

          
        

        - **ManagedBy** *(string) --* 

          The entity that manages the IMDS default settings. Possible values include:

           

          
          * ``account`` - The IMDS default settings are managed by the account.
           
          * ``declarative-policy`` - The IMDS default settings are managed by a declarative policy and can't be modified by the account.
          

          
        

        - **ManagedExceptionMessage** *(string) --* 

          The customized exception message that is specified in the declarative policy.

          
    
  