Route 53 Resolver Magic
Tags: route53, aws
Published: 2023-05-22 19:36:39

This post covers some core concepts of Route 53 Resolvers and how they can help establish inbound and outbound name resoltion with your on-premise and AWS resources.

## Introduction

Route 53 resolvers are a feature of Route 53 that allows you to route DNS queries between your VPC and your on-premises network.

This feature lets you resolve domain names hosted within your VPCs and across your hybrid cloud environment.

> **NOTE**: Route 53 Resolvers are associated with a region as they are hosted in a VPC, unlike most of the Route 53 service, which is global.

## Resolver Types

There are two main types of Route 53 resolvers: inbound and outbound. Both work by forwarding DNS queries to the appropriate DNS servers.

When your device sends a DNS query for a domain name, the resolver will check its cache to see if it already has the IP address for that domain name. If it doesn't, the resolver will forward the query to the appropriate DNS servers to get the IP address.

Once the resolver has the IP address, it will return it to your device, which can then use it to connect to the resource associated with that domain name.

### Inbound

Inbound resolvers enable the resolution of private hosted zones associated with a VPC.

When you create a VPC, you can configure it to use a private hosted zone in Route 53, enabling the resolution of names to IP addresses specific to your VPC.

You can then set up inbound resolvers within your VPC to help your resources find other resources by resolving their domain names to IP addresses.

Inbound resolvers are also helpful for resolving domain names to IP addresses for resources outside your VPC, such as on-premise.

![Inbound Resolver Flow](https://cdn.hashnode.com/res/hashnode/image/upload/v1680648813247/3a549127-3673-4ac5-871c-45cec38338f4.png)

### Outbound

Outbound resolvers enable the resolution of domain names outside of your VPC.

When you set up an outbound resolver, you can specify the IP addresses of the DNS servers you want to use for resolution. This can be useful if you want to use a specific DNS service for resolving domain names, such as a third-party or internal DNS provider.

They can help you connect to resources on the internet, such as public domain names and other AWS services that are outside of your VPC.

![Outbound Resolver Flow](https://cdn.hashnode.com/res/hashnode/image/upload/v1680648832081/31839f7b-7eff-4d90-a737-fde48efa9b85.png)

> NOTE: The above shows an on-premise DNS server; however, this could be an external DNS server on the public internet.

## Rules

A resolver rule is a set of criteria the Route 53 resolver uses to determine how to route DNS queries, and they are only applicable to the outbound resolver.

Expanding on the example above to resolve onpremise.net for instances inside the VPC, we would configure a forwarding rule for onpremise.net and point it to the internal DNS server.

![Outbound Rules](https://cdn.hashnode.com/res/hashnode/image/upload/v1680650495997/4735652e-398d-40d7-8112-92568a568919.png)

## Resource Access Manager (RAM)

RAM allows you to share your resolver rules and endpoints with other accounts in your organization. This method will enable you to define your rules once but use them across many VPCs.

This can be particularly useful when you have a central team responsible for managing DNS and want to ensure consistent DNS resolution across your organization.

![RAM VPC Rule Sharing](https://cdn.hashnode.com/res/hashnode/image/upload/v1680678160497/6e59cdf8-b43a-4a43-a291-e9b67eb3be52.png)

> NOTE: The traffic between the resolvers in each VPC and the outbound resolver goes over the AWS Global Network. There is no requirement for the VPC CIDR ranges to be able to route to the outbound resolver endpoints.

## Best Practices

Here are a few things to consider for your architecture.

### Use Resolver Rules Wisely

Create forwarding rules to route DNS queries for specific domains or subdomains to specific DNS resolvers. This allows you to control traffic flow and improve the efficiency of DNS resolution. Be sure to prioritize the most critical domains and establish a hierarchy of rules to minimize latency.

### Endpoint Placement

Place Resolver Endpoints Strategically to manage DNS query traffic between your VPCs and on-premises networks. Place these endpoints in subnets with low latency and high network throughput to ensure fast and reliable query resolution. As shown above RAM can also assist with sharing those endpoints.

### Restrict if required

Resolvers need protection just like any other endpoint in your network. Configure the necessary Security Groups and Network Access Control Lists (ACLs) to protect your resolver endpoints. Limit access to only necessary IP ranges and ports, ensuring that only authorized users and applications can interact with your DNS infrastructure.

### Logging

Enable DNS Query Logging Enable logging of DNS queries to track and analyze traffic patterns, identify potential security threats, and debug any issues related to DNS resolution. Route 53 Resolver can send query logs to Amazon CloudWatch Logs, enabling you to create custom metrics and alarms for monitoring.

### Monitoring

Monitor key performance metrics, such as query latency, query volume, and resolver endpoint health, to identify potential bottlenecks and capacity constraints. As your application and infrastructure grow, scale your Route 53 Resolver setup by adding additional resolver endpoints, rules, and VPC peering connections as needed.

## Summary

Every hybrid network AWS setup is going to need some sort of name resolution and I hope you now have a good understanding of the capabilities of Route 53 Resolver.

Hope this helps someone else.

Cheers