1. Does Route 53 GeoDNS Support Ports?
No, DNS services do not support ports. This is a limitation of the global Domain Name System (DNS) protocol itself, not just AWS Route 53.
A standard DNS record (like an A or AAAA record) can only map a domain name to an IP address. It cannot map a domain to an IP and a port (e.g., you cannot point example.com to 192.0.2.1:8080 via an A record).
How to handle ports:
- Standard Web Traffic (Ports 80/443): If your target servers are running on alternative ports (like
8080or3000), you cannot use DNS to mask it. Users will have to type the port manually (e.g.,example.com:8080). - The Solution (Reverse Proxy / Load Balancer): To hide the port from users, you must route DNS to a reverse proxy or Load Balancer (like an AWS ALB or Nginx instance) running on standard ports
80/443. That proxy will then forward the traffic internally to your backend port.
2. How to Setup GeoDNS in AWS Route 53
Setting up geographic routing in Route 53 is done using Geolocation Routing Policies. Follow these steps to set it up:
Step 1: Create a Hosted Zone
- Open the AWS Management Console and navigate to Route 53.
- Click Hosted zones in the left menu, then click Create hosted zone.
- Enter your Domain name (e.g.,
example.com), select Public hosted zone, and click Create. - (Crucial) AWS will generate 4 Name Servers (NS records). You must copy these and paste them into your domain registrar (e.g., Namecheap, GoDaddy, or Cloudflare if using Cloudflare as registrar) to delegate control to AWS.
Step 2: Create Regional GeoDNS Records
You will create multiple records for the same domain name, but assign each one to a different geographic location.
- Inside your hosted zone, click Create record.
- Record name: Leave blank for the root domain (
example.com) or type a subdomain (e.g.,www). - Record type: Select A – Routes traffic to an IPv4 address.
- Value: Type the IP address of your Region A server (e.g., your European server).
- Routing policy: Change this from Simple routing to Geolocation.
- Location: Select the continent or country this server should handle (e.g., Select Europe).
- Record ID: Type a unique label to identify this specific record (e.g.,
eu-server). - Click Create records.
Repeat this process for your other servers. For example, create a second record with the exact same name, but input your US Server IP, set the location to North America, and name the Record ID us-server.
Step 3: Create a “Default” Catch-All Record (Mandatory)
If a user visits your site from a location you didn’t explicitly map (e.g., an internet user in Asia or South America), Route 53 will return an error unless you create a default record.
- Click Create record again using the exact same record name and type.
- Value: Input the IP address of your primary or most robust server.
- Routing policy: Select Geolocation.
- Location: Select Default (this catches all traffic from unmapped locations).
- Record ID: Type
default-catchall. - Click Create records.
Are your backend applications currently running on custom ports?
If so, tell me what tech stack or server software you are using (e.g., Nginx, Node.js, Docker, AWS EC2), and I can show you how to set up a quick reverse proxy so your users don’t have to type the port numbers.