Hello, Can someone explain how does a dns request flow from an ec2 instance in . . .

Juhi Singh:
Hello, Can someone explain how does a dns request flow from an ec2 instance in private subnet to route53 resolver outbound endpoint via a nat gateway?
My dns requests are getting duplicated somewhere in AWS and I am unable to debug the issue with vpc flowlogs.

Juhi Singh:
Route 53 resolver outbound endpoint has a rule to forward all the requests to an external dns server.
In nat gw vpc flow logs, I see requests going to Route53 resolver outbound endpoints and also to the external dns server. Is that expected?

Aswin Venkat:
@Juhi Singh When an EC2 instance in a private subnet sends a DNS request to a Route53 resolver outbound endpoint via a NAT gateway, the following steps occur:

  1. The EC2 instance sends a DNS query to the NAT gateway.
  2. The NAT gateway replaces the source IP address of the query with its own IP address and sends the query to the Route53 resolver outbound endpoint.
  3. The Route53 resolver outbound endpoint receives the query and forwards it to the appropriate DNS resolver.
  4. The DNS resolver processes the query and sends a response back to the Route53 resolver outbound endpoint.
  5. The Route53 resolver outbound endpoint receives the response and sends it back to the NAT gateway.
  6. The NAT gateway replaces the destination IP address of the response with the IP address of the EC2 instance and sends the response back to the instance.