TestDNSAnswer - Amazon Route 53

TestDNSAnswer

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.

Request Syntax

GET /2013-04-01/testdnsanswer?edns0clientsubnetip=EDNS0ClientSubnetIP&edns0clientsubnetmask=EDNS0ClientSubnetMask&hostedzoneid=HostedZoneId&recordname=RecordName&recordtype=RecordType&resolverip=ResolverIP HTTP/1.1

URI Request Parameters

The request uses the following URI parameters.

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.

Length Constraints: Maximum length of 45.

Pattern: (^((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))$|^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$)

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

Length Constraints: Minimum length of 0. Maximum length of 3.

hostedzoneid

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

Length Constraints: Maximum length of 32.

Required: Yes

recordname

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

Length Constraints: Maximum length of 1024.

Required: Yes

recordtype

The type of the resource record set.

Valid Values: SOA | A | TXT | NS | CNAME | MX | NAPTR | PTR | SRV | SPF | AAAA | CAA | DS | TLSA | SSHFP | SVCB | HTTPS

Required: Yes

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 AWS US East (N. Virginia) Region (us-east-1).

Length Constraints: Maximum length of 45.

Pattern: (^((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))$|^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$)

Request Body

The request does not have a request body.

Response Syntax

HTTP/1.1 200 <?xml version="1.0" encoding="UTF-8"?> <TestDNSAnswerResponse> <Nameserver>string</Nameserver> <Protocol>string</Protocol> <RecordData> <RecordDataEntry>string</RecordDataEntry> </RecordData> <RecordName>string</RecordName> <RecordType>string</RecordType> <ResponseCode>string</ResponseCode> </TestDNSAnswerResponse>

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in XML format by the service.

TestDNSAnswerResponse

Root level tag for the TestDNSAnswerResponse parameters.

Required: Yes

Nameserver

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

Type: String

Length Constraints: Minimum length of 0. Maximum length of 255.

Protocol

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

Type: String

RecordData

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

Type: Array of strings

Length Constraints: Minimum length of 0. Maximum length of 512.

RecordName

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

Type: String

Length Constraints: Maximum length of 1024.

RecordType

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

Type: String

Valid Values: SOA | A | TXT | NS | CNAME | MX | NAPTR | PTR | SRV | SPF | AAAA | CAA | DS | TLSA | SSHFP | SVCB | HTTPS

ResponseCode

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 on the IANA website.

Type: String

Errors

For information about the errors that are common to all actions, see Common Errors.

InvalidInput

The input is not valid.

HTTP Status Code: 400

NoSuchHostedZone

No hosted zone exists with the ID that you specified.

HTTP Status Code: 404

Examples

Example Request

This example illustrates one usage of TestDNSAnswer.

GET /2013-04-01/testdnsanswer?hostedzoneid=Z111111QQQQQQQ&recordname=www.example.com&recordtype=A&resolverip=192.0.2.44

Example Response

This example illustrates one usage of TestDNSAnswer.

<?xml version="1.0" encoding="UTF-8"?> <TestDnsAnswerResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/"> <Nameserver>ns-2048.awsdns-64.com</Nameserver> <RecordName>www.example.com</RecordName> <RecordType>A</RecordType> <RecordData> <RecordDataEntry>198.51.100.222</RecordDataEntry> </RecordData> <ResponseCode>NOERROR</ResponseCode> <Protocol>UDP</Protocol> </TestDnsAnswerResponse>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: