0Pricing
AWS Solutions Architect · Lesson

Failover and Geolocation Routing

Configure active-passive failover with health checks and restrict or customise responses by the geographic origin of queries.

Failover and Geolocation Routing is a free AWS Solutions Architect lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the AWS Solutions Architect learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Failover Routing Overview

Failover routing implements an active-passive configuration: one record is designated Primary and another is Secondary. Route 53 always returns the Primary record as long as its health check passes. If the Primary becomes unhealthy, Route 53 automatically switches to returning the Secondary record.

Failover routing is the go-to pattern for disaster recovery scenarios where you have a production environment (primary) and a standby environment (secondary) that should only receive traffic when the primary is down.

Configuring Failover Records

To set up failover routing, create two records with the same DNS name: one with Failover=PRIMARY and one with Failover=SECONDARY. Attach a health check to the Primary record. The Secondary record should also have a health check if it points to a resource that could fail independently.

The Secondary record acts as a static fallback—it can point to an S3 static website, a maintenance page, or a scaled-down standby environment. Even if the Secondary has no health check, Route 53 always falls back to it when the Primary fails.

# Create primary failover record
aws route53 change-resource-record-sets \
  --hosted-zone-id Z1234567890 \
  --change-batch '{
    "Changes": [{
      "Action": "CREATE",
      "ResourceRecordSet": {
        "Name": "app.example.com",
        "Type": "A",
        "SetIdentifier": "primary",
        "Failover": "PRIMARY",
        "TTL": 60,
        "ResourceRecords": [{"Value": "54.100.1.1"}],
        "HealthCheckId": "hc-primary-id"
      }
    }]
  }'

Active-Passive vs Active-Active

Failover routing creates an active-passive setup: only the Primary serves traffic during normal operation; the Secondary sits idle waiting to take over. This minimises cost for the standby but results in slightly longer recovery time (the time for DNS TTL to expire and Route 53 to switch).

For active-active setups (both resources serving traffic simultaneously), use Weighted routing (equal weights) or Latency routing. If one resource fails, its health check fails and Route 53 removes it from DNS responses automatically—achieving active-active with built-in failover.

Geolocation Routing Overview

Geolocation routing routes DNS queries based on the geographic location of the DNS resolver (typically the user's ISP resolver or AWS Route 53 Resolver). You create records for specific continents, countries, or US states, and Route 53 returns the record whose location most specifically matches the query source.

If no specific location record matches, Route 53 returns a default record (if configured). Without a default, queries from unmatched locations receive NODATA. Always create a default record to handle users from locations you have not explicitly configured.

# Create a geolocation record for Germany
aws route53 change-resource-record-sets \
  --hosted-zone-id Z1234567890 \
  --change-batch '{
    "Changes": [{
      "Action": "CREATE",
      "ResourceRecordSet": {
        "Name": "www.example.com",
        "Type": "A",
        "SetIdentifier": "germany",
        "GeoLocation": {"CountryCode": "DE"},
        "TTL": 60,
        "ResourceRecords": [{"Value": "54.200.1.1"}]
      }
    }]
  }'

Geolocation Routing Use Cases

Key use cases for Geolocation routing:

  • Language-specific content: route French speakers to a French-language CDN origin, German speakers to a German origin
  • Regulatory compliance: ensure EU user data stays in EU Regions (GDPR), or block access from specific countries
  • Localised pricing or availability: show region-specific prices or restrict services to supported territories
  • Geo-blocking: return a block page or empty response for users from restricted locations by pointing their geolocation record to a maintenance endpoint

Geolocation Specificity and Default Record

Route 53 matches the most specific geolocation: a state-level record takes precedence over a country-level record, which takes precedence over a continent-level record, which takes precedence over the default. US state-level geolocation is only available for the United States.

If you omit a default record and a user's location matches no configured record, Route 53 returns NXDOMAIN or NODATA—this silently breaks access for users in unconfigured regions. Always add a default geolocation record as a catch-all to avoid silent failures.

Geoproximity Routing

Geoproximity routing routes traffic based on the physical geographic distance between users and resources, with an optional bias to expand or shrink the effective routing radius of each resource. A positive bias expands the geographic area that a resource serves; a negative bias shrinks it.

Geoproximity is only available through Traffic Flow (Route 53's visual routing policy editor) and supports both AWS Regions (which Route 53 knows the coordinates of automatically) and custom resource locations where you provide latitude and longitude.

Route 53 Traffic Flow

Route 53 Traffic Flow is a visual policy editor that lets you build complex routing logic by combining multiple routing policies in a tree-like diagram. For example, you can first apply geolocation to separate EU traffic, then apply latency within EU to choose the best-performing Region, and finally use weighted routing within each Region for blue-green deployments.

Traffic Flow policies are versioned, allowing you to test changes safely. You associate a Traffic Flow policy with one or more DNS names, and updates to the policy propagate instantly without recreating individual records.

Combining Failover with Other Policies

Failover routing can be nested inside other policies. A common pattern: use Latency routing to pick the closest Region, but within each Region use a Failover record so if the primary endpoint in that Region fails, traffic automatically shifts to a secondary endpoint in the same Region.

Another pattern: multi-Region active-passive using Latency routing for the primary endpoint. If the primary Region's health check fails, Route 53 falls through to the next-lowest-latency healthy Region—effectively combining latency optimisation with DR failover.

Health Check Requirements for Failover

For failover routing to work correctly, the Primary record must** have a health check attached. Without a health check, Route 53 treats the Primary as always healthy and never switches to the Secondary. The Secondary record may optionally have its own health check; if the Secondary also fails, Route 53 returns the Secondary's address anyway (it is the last resort).

Health check types you can use with failover: HTTP/HTTPS endpoint checks, TCP checks, and CloudWatch alarm checks (useful for composite application health signals that combine multiple metrics).

Geolocation vs Latency: Exam Distinction

This distinction appears frequently on the SAA-C03 exam:

  • Geolocation: routes by where the user is located geographically—always returns the same endpoint for a given country/continent regardless of performance; used for content localisation and compliance
  • Latency: routes by network performance to the user—may route a user in Europe to us-east-1 if it is faster than eu-west-1 at that moment; used for performance optimisation

Keywords in exam questions: 'comply with data residency', 'country-specific content', 'block users from certain regions' → Geolocation. 'closest Region', 'lowest latency', 'best performance for global users' → Latency.

Quick Check

Test your understanding of AWS Solutions Architect (SAA-C03) concepts from this lesson.

Lesson Recap

In this lesson you learned: Failover routing creates active-passive HA by switching to the Secondary when the Primary's health check fails, Geolocation routing directs users by geographic origin for compliance and localisation, and Geoproximity routing uses physical distance with configurable bias via Traffic Flow. Always add a default geolocation record to handle unmatched locations. Next up we explore health checks and DNS failover in depth.

Frequently asked questions

Is the “Failover and Geolocation Routing” lesson free?

Yes — the full text of “Failover and Geolocation Routing” is free to read here on the web, and the AWS Solutions Architect course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the AWS Solutions Architect course, upgrade to CoddyKit PRO.

What will I learn in “Failover and Geolocation Routing”?

Configure active-passive failover with health checks and restrict or customise responses by the geographic origin of queries. You practise AWS Solutions Architect with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start AWS Solutions Architect?

No prior experience is required. AWS Solutions Architect on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Failover and Geolocation Routing” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this AWS Solutions Architect lesson?

Yes. Every AWS Solutions Architect lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Hosted Zones and DNS Record Types
  2. Routing Policies: Simple, Weighted, and Latency
  3. Failover and Geolocation Routing
  4. Health Checks and DNS Failover
← Back to AWS Solutions Architect