Amazon AWS Route 53 GEO DNS Configurations

You can send visitors to different servers based on country of their IP address using Amazon Route 53 cloud based dns server. For example, if you have a server in Amsterdam, a server in America, and a server in Singapore, then you can easily route traffic for visitors in Europe to the Amsterdam server, people in Asia go to the Singapore server and those in the rest of the world be served by the American server. This will results into the various kinds of benefits such as:

  1. Better performance as you are sending web site visitors to their nearest web server.
  2. Reduced load on origin.
  3. Geomarketing/online advertising.
  4. Restricting content to those geolocated in specific countries (I am not a big fan of DRM).
  5. In some cases you can get potentially lower costs and more.

In this post, I will explain how to configure and test GeoDNS using AWS Route 53 service.

Our sample setup

Fig.01: Sample geodns setup for HTTP/SMTP service

Please note that IPs ( or CNAMEs ( can be hosted by AWS or your own server anywhere in the world.

AWS Route 53 routing policy

From the Route 53 documents:

If your application is hosted on Amazon EC2 instances in multiple EC2 regions, you can reduce latency for your end users by serving their requests from the EC2 region for which network latency is lowest. Route 53 latency-based routing lets you use DNS to route end-user requests to the EC2 region that will give your users the fastest response.

It is possible to use Route 53’s Latency Based Routing (LBR) feature with non-AWS endpoints or IP address. Route 53 don’t restrict what IPs or CNAMEs you can tag with a region. AWS dns server will route traffic to those IPs/CNAMEs “as if” those IPs or CNAMEs were hosted in whichever AWS region you choose to tag. The following is the current list of regions supported by Route 53 LBR:

  1. Nothern Virginia, US: us-east-1
  2. Nothern California, US: us-west-1
  3. Oregon, US: us-west-2
  4. Ireland, EU: eu-west-1
  5. Singapore, Asia: ap-southeast-1
  6. Tokyo, Asia: ap-northeast-1
  7. Sydney, Asia: ap-southeast-2
  8. Sao Paulo, South America: sa-east-1


First, open the Amazon Route 53 console at > Choose your existing domain > Click on the Go to Record Sets button > Click on the Create Record Set button.

CNAME geodns settings for USA Dallas server

  1. Set Name to www.l.
  2. Choose Type to CNAME.
  3. Set TTL to 30 seconds.
  4. Set Value to seconds.
  5. Set Routing Policy to Latency.
  6. Set Region to us-west-1.
  7. Set ID to Dallas, TX, Data Center.
  8. Click the Create Record set button to save the changes.

Fig.02: CNAME geodns settings for Dallas/USA server.

Set an IP address for CNAME

Visit the Amazon Route 53 console at > Choose your existing domain > Click on the Go to Record Sets button > Click on the Create Record Set button.

  1. Set Name to w.usa.
  2. Set Type to A - IPv4 address.
  3. Set TTL to 30 seconds.
  4. Set Value to Please replace IP address with your actual AWS endpoint or any other valid public IP address in US.
  5. Set Routing Policy to Simple.
  6. Click the Create Record set button to save the changes.

Fig.03: Set an IP address for CNAME

Repeat this process for the rest of your HTTP and SMTP services. At the end, your setup should look like as follows:

Fig.04: Showing all CNAME and AWS geo mapping for each region (click to enlarge).

Fig.05: IP address for all CNAMEs.

Test it

Use the following dig or host dns lookup command line utilities to verify new settings:
% dig +short
Sample outputs from various locations:

## Asia  ##
## Office in UK ##
## IDC in US ##

The following images shows the accuracy of geo name-to-IP address resolutions around the world for

Fig.06: Route 53 geo location accuracy


Use of proxy servers, third party DNS servers other than your ISPs and VPN may give a false geo location to end-users.

GeoIP limitations – Credit XKCD

The dig command output from my home using Google free DNS servers:
% dig +short @
Sample outputs:

However, OpenDNS sent visitor to EU data center
% dig +short @
Sample outputs:


The Route 53 provides a simple, and accurate geo targeting based on LBR. This is useful to direct traffic to a server geographically closer to the end-user. The server can be hosted with AWS or anywhere else in the world. The next logical step is to set up a database replication and upload your Python/PHP/Perl and other files (JS/CSS/Images) to servers so that end users can view the same content.


🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 4 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
4 comments… add one
  • ChrisUeland Apr 28, 2013 @ 18:50

    nice article!

  • Gaurav Galia Apr 29, 2013 @ 5:16

    Excellent.. I am following you since I learn linux and most of the things I catch up from you are into productions.


  • 4thaugust1932 Apr 29, 2013 @ 7:18 offers free geo based DNS

  • Rahul Bansal Oct 5, 2013 @ 8:41

    Thanks for nice and I think only useful article around.

    Though, I did not get purpose of getting CNAME involved? Wont’ using A addressed directly will simplify records?

    Also, why not add health-checks as it could automatic failover?

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum