:doc:`Route53 <../../route53>` / Client / test_dns_answer

***************
test_dns_answer
***************



.. py:method:: Route53.Client.test_dns_answer(**kwargs)

  

  Gets the value that Amazon Route 53 returns in response to a DNS request for a specified record name and type. You can optionally specify the IP address of a DNS resolver, an EDNS0 client subnet IP address, and a subnet mask.

   

  This call only supports querying public hosted zones.

   

  .. note::

    

    The ``TestDnsAnswer`` returns information similar to what you would expect from the answer section of the ``dig`` command. Therefore, if you query for the name servers of a subdomain that point to the parent name servers, those will not be returned.

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/TestDNSAnswer>`_  


  **Request Syntax**
  ::

    response = client.test_dns_answer(
        HostedZoneId='string',
        RecordName='string',
        RecordType='SOA'|'A'|'TXT'|'NS'|'CNAME'|'MX'|'NAPTR'|'PTR'|'SRV'|'SPF'|'AAAA'|'CAA'|'DS'|'TLSA'|'SSHFP'|'SVCB'|'HTTPS',
        ResolverIP='string',
        EDNS0ClientSubnetIP='string',
        EDNS0ClientSubnetMask='string'
    )
    
  :type HostedZoneId: string
  :param HostedZoneId: **[REQUIRED]** 

    The ID of the hosted zone that you want Amazon Route 53 to simulate a query for.

    

  
  :type RecordName: string
  :param RecordName: **[REQUIRED]** 

    The name of the resource record set that you want Amazon Route 53 to simulate a query for.

    

  
  :type RecordType: string
  :param RecordType: **[REQUIRED]** 

    The type of the resource record set.

    

  
  :type ResolverIP: string
  :param ResolverIP: 

    If you want to simulate a request from a specific DNS resolver, specify the IP address for that resolver. If you omit this value, ``TestDnsAnswer`` uses the IP address of a DNS resolver in the Amazon Web Services US East (N. Virginia) Region ( ``us-east-1``).

    

  
  :type EDNS0ClientSubnetIP: string
  :param EDNS0ClientSubnetIP: 

    If the resolver that you specified for resolverip supports EDNS0, specify the IPv4 or IPv6 address of a client in the applicable location, for example, ``192.0.2.44`` or ``2001:db8:85a3::8a2e:370:7334``.

    

  
  :type EDNS0ClientSubnetMask: string
  :param EDNS0ClientSubnetMask: 

    If you specify an IP address for ``edns0clientsubnetip``, you can optionally specify the number of bits of the IP address that you want the checking tool to include in the DNS query. For example, if you specify ``192.0.2.44`` for ``edns0clientsubnetip`` and ``24`` for ``edns0clientsubnetmask``, the checking tool will simulate a request from 192.0.2.0/24. The default value is 24 bits for IPv4 addresses and 64 bits for IPv6 addresses.

     

    The range of valid values depends on whether ``edns0clientsubnetip`` is an IPv4 or an IPv6 address:

     

    
    * **IPv4**: Specify a value between 0 and 32
     
    * **IPv6**: Specify a value between 0 and 128
    

    

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

    
    ::

      {
          'Nameserver': 'string',
          'RecordName': 'string',
          'RecordType': 'SOA'|'A'|'TXT'|'NS'|'CNAME'|'MX'|'NAPTR'|'PTR'|'SRV'|'SPF'|'AAAA'|'CAA'|'DS'|'TLSA'|'SSHFP'|'SVCB'|'HTTPS',
          'RecordData': [
              'string',
          ],
          'ResponseCode': 'string',
          'Protocol': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 

      A complex type that contains the response to a ``TestDNSAnswer`` request.

      
      

      - **Nameserver** *(string) --* 

        The Amazon Route 53 name server used to respond to the request.

        
      

      - **RecordName** *(string) --* 

        The name of the resource record set that you submitted a request for.

        
      

      - **RecordType** *(string) --* 

        The type of the resource record set that you submitted a request for.

        
      

      - **RecordData** *(list) --* 

        A list that contains values that Amazon Route 53 returned for this resource record set.

        
        

        - *(string) --* 

          A value that Amazon Route 53 returned for this resource record set. A ``RecordDataEntry`` element is one of the following:

           

          
          * For non-alias resource record sets, a ``RecordDataEntry`` element contains one value in the resource record set. If the resource record set contains multiple values, the response includes one ``RecordDataEntry`` element for each value.
           
          * For multiple resource record sets that have the same name and type, which includes weighted, latency, geolocation, and failover, a ``RecordDataEntry`` element contains the value from the appropriate resource record set based on the request.
           
          * For alias resource record sets that refer to Amazon Web Services resources other than another resource record set, the ``RecordDataEntry`` element contains an IP address or a domain name for the Amazon Web Services resource, depending on the type of resource.
           
          * For alias resource record sets that refer to other resource record sets, a ``RecordDataEntry`` element contains one value from the referenced resource record set. If the referenced resource record set contains multiple values, the response includes one ``RecordDataEntry`` element for each value.
          

          
    
      

      - **ResponseCode** *(string) --* 

        A code that indicates whether the request is valid or not. The most common response code is ``NOERROR``, meaning that the request is valid. If the response is not valid, Amazon Route 53 returns a response code that describes the error. For a list of possible response codes, see `DNS RCODES <http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-6>`__ on the IANA website.

        
      

      - **Protocol** *(string) --* 

        The protocol that Amazon Route 53 used to respond to the request, either ``UDP`` or ``TCP``.

        
  
  **Exceptions**
  
  *   :py:class:`Route53.Client.exceptions.NoSuchHostedZone`

  
  *   :py:class:`Route53.Client.exceptions.InvalidInput`

  