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

**************************
describe_instance_topology
**************************



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

  

  Describes a tree-based hierarchy that represents the physical host placement of your EC2 instances within an Availability Zone or Local Zone. You can use this information to determine the relative proximity of your EC2 instances within the Amazon Web Services network to support your tightly coupled workloads.

   

  Instance topology is supported for specific instance types only. For more information, see `Prerequisites for Amazon EC2 instance topology <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-topology-prerequisites.html>`__ in the *Amazon EC2 User Guide*.

   

  .. note::

    

    The Amazon EC2 API follows an eventual consistency model due to the distributed nature of the system supporting it. As a result, when you call the DescribeInstanceTopology API command immediately after launching instances, the response might return a ``null`` value for ``capacityBlockId`` because the data might not have fully propagated across all subsystems. For more information, see `Eventual consistency in the Amazon EC2 API <https://docs.aws.amazon.com/ec2/latest/devguide/eventual-consistency.html>`__ in the *Amazon EC2 Developer Guide*.

    

   

  For more information, see `Amazon EC2 topology <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-topology.html>`__ in the *Amazon EC2 User Guide*.

  

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


  **Request Syntax**
  ::

    response = client.describe_instance_topology(
        DryRun=True|False,
        NextToken='string',
        MaxResults=123,
        InstanceIds=[
            'string',
        ],
        GroupNames=[
            'string',
        ],
        Filters=[
            {
                'Name': 'string',
                'Values': [
                    'string',
                ]
            },
        ]
    )
    
  :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``.

    

  
  :type NextToken: string
  :param NextToken: 

    The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.

    

  
  :type MaxResults: integer
  :param MaxResults: 

    The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see `Pagination <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination>`__.

     

    You can't specify this parameter and the instance IDs parameter in the same request.

     

    Default: ``20``

    

  
  :type InstanceIds: list
  :param InstanceIds: 

    The instance IDs.

     

    Default: Describes all your instances.

     

    Constraints: Maximum 100 explicitly specified instance IDs.

    

  
    - *(string) --* 

    

  :type GroupNames: list
  :param GroupNames: 

    The name of the placement group that each instance is in.

     

    Constraints: Maximum 100 explicitly specified placement group names.

    

  
    - *(string) --* 

    

  :type Filters: list
  :param Filters: 

    The filters.

     

    
    * ``availability-zone`` - The name of the Availability Zone (for example, ``us-west-2a``) or Local Zone (for example, ``us-west-2-lax-1b``) that the instance is in.
     
    * ``instance-type`` - The instance type (for example, ``p4d.24xlarge``) or instance family (for example, ``p4d*``). You can use the ``*`` wildcard to match zero or more characters, or the ``?`` wildcard to match zero or one character.
     
    * ``zone-id`` - The ID of the Availability Zone (for example, ``usw2-az2``) or Local Zone (for example, ``usw2-lax1-az1``) that the instance is in.
    

    

  
    - *(dict) --* 

      A filter name and value pair that is used to return a more specific list of results from a describe operation. Filters can be used to match a set of resources by specific criteria, such as tags, attributes, or IDs.

       

      If you specify multiple filters, the filters are joined with an ``AND``, and the request returns only results that match all of the specified filters.

       

      For more information, see `List and filter using the CLI and API <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Filtering.html#Filtering_Resources_CLI>`__ in the *Amazon EC2 User Guide*.

      

    
      - **Name** *(string) --* 

        The name of the filter. Filter names are case-sensitive.

        

      
      - **Values** *(list) --* 

        The filter values. Filter values are case-sensitive. If you specify multiple values for a filter, the values are joined with an ``OR``, and the request returns all results that match any of the specified values.

        

      
        - *(string) --* 

        
    
    

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

    
    ::

      {
          'Instances': [
              {
                  'InstanceId': 'string',
                  'InstanceType': 'string',
                  'GroupName': 'string',
                  'NetworkNodes': [
                      'string',
                  ],
                  'AvailabilityZone': 'string',
                  'ZoneId': 'string',
                  'CapacityBlockId': 'string'
              },
          ],
          'NextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **Instances** *(list) --* 

        Information about the topology of each instance.

        
        

        - *(dict) --* 

          Information about the instance topology.

          
          

          - **InstanceId** *(string) --* 

            The instance ID.

            
          

          - **InstanceType** *(string) --* 

            The instance type.

            
          

          - **GroupName** *(string) --* 

            The name of the placement group that the instance is in.

            
          

          - **NetworkNodes** *(list) --* 

            The network nodes. The nodes are hashed based on your account. Instances from different accounts running under the same server will return a different hashed list of strings.

             

            The value is ``null`` or empty if:

             

            
            * The instance type is not supported.
             
            * The instance is in a state other than ``running``.
            

            
            

            - *(string) --* 
        
          

          - **AvailabilityZone** *(string) --* 

            The name of the Availability Zone or Local Zone that the instance is in.

            
          

          - **ZoneId** *(string) --* 

            The ID of the Availability Zone or Local Zone that the instance is in.

            
          

          - **CapacityBlockId** *(string) --* 

            The ID of the Capacity Block. This parameter is only supported for UltraServer instances and identifies instances within the UltraServer domain.

            
      
    
      

      - **NextToken** *(string) --* 

        The token to include in another request to get the next page of items. This value is ``null`` when there are no more items to return.

        
  