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:
- The EC2 instance sends a DNS query to the NAT gateway.
- 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.
- The Route53 resolver outbound endpoint receives the query and forwards it to the appropriate DNS resolver.
- The DNS resolver processes the query and sends a response back to the Route53 resolver outbound endpoint.
- The Route53 resolver outbound endpoint receives the response and sends it back to the NAT gateway.
- 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.