Skip to main content

Command Palette

Search for a command to run...

Part 3: Geolocation Routing Policy

Updated
2 min read
Part 3: Geolocation Routing Policy

Introduction

In a globally distributed application, not all users should be treated the same. There are certain scenarios that would prompt you to block access to your web application:

  1. Regulatory & Legal Compliance

  2. Licensing & Content Distribution Rights

  3. Fraud Prevention & Security Hardening

  4. Service Availability Limitations

  5. Beta Testing / Controlled Rollouts

  6. Legal Liability & Risk Mitigation

  7. Business Strategy / Market Focus

This is where Amazon Route 53 Geolocation Routing Policy becomes essential.

In this post, we’ll explore how to route traffic based on the user’s geographic location, with hands-on steps.

What is Geolocation Routing?

Geolocation routing allows you to route traffic based on:

  • Continent

  • Country

  • (in some cases in Ukraine) subdivisions

Prerequisites

  • Hosted zone in Route 53

  • At least 2 resources (EC2, ALB, etc.) in different regions

  • Public IPs or DNS endpoints

Step-by-Step Implementation

Step 1: Create First Record (Frankfurt)

  • Record name: geolocation

  • Type: A

  • Value: IP of Europe server

  • Routing policy: Geolocation

  • Location: Countries/Regions→ Germany

  • Record ID: Choose what tag to use (Germany Server)

Step 2: Create Second Record (North Virginia)

  • Record name: geolocation

  • Type: A

  • Value: IP of the North Virginia server

  • Routing policy: Geolocation

  • Location: Default (any traffic that is not from Germany gets routed to the North Virginia server)

  • Record ID: Every other traffic worldwide - North Virginia

Testing Geolocation Routing

I will use my proxy set to Germany to test out whether DNS works on resolver location.

So, my traffic now seems to come from Germany - Frankfurt

When I type http://geolocation.cloudproject.click it directs me to the German server

If I use my real traffic from Kenya, it directs me to the North Virginia server thus proving that the geolocation routing policy works