Route by weight or location

Let one record set answer from several variants, chosen per query by weight or by the client's country or continent.

Last updated 18 November 2026View as Markdown

Replace zone-id with the id of your hosted zone. Routing works on A, AAAA, CNAME, MX, TXT and SRV sets.

How it behaves

Weighted: each answer is one variant, picked at random in proportion to its weight (0 to 255). A variant with weight 0 is not answered while another has a weight above 0; when every weight is 0, the variants are answered equally often. Use it for a canary or a blue/green switch.

Geolocation: the variant for the client's country, otherwise the variant for its continent (AF, AN, AS, EU, NA, OC, SA), otherwise the set's own values, the default. The client's location comes from the EDNS Client Subnet its resolver sends, or else from the resolver's own address; a resolver that sends no client subnet is located where it is itself. The answer says which subnet it was made for, so resolvers cache it per subnet.

Health checks: any variant may name an uptime check (healthCheckId). While the check is down, that variant is not answered; when every variant's check is down, all variants are answered. A set with variant checks is served with a TTL of at most 60 seconds. A routed set cannot also have a failover health check of its own.

Signed zones sign whichever variant is answered.

Prerequisites

  • Permission for dns:ChangeRecords on the zone.
  • For variant health checks, uptime checks of your organization.

Create a routed set

Not available in Console. The console shows a routed set's variants but cannot create or change them; editing a routed set there keeps its routing.

To change the routing, send a new routing in an edit (PUT …/records/{recordId}); to remove it, send "routing": null.

Rules

  • A weighted set has 1 to 20 variants, a geolocation set 1 to 50.
  • Each variant has an id of 1 to 64 characters, unique in the set, and 1 to 100 values.
  • A geolocation variant names exactly one of country (two letters, such as DE) or continent, and no two variants name the same place.

Refusals are 400, for example "Only … records can be routed" for another type, "Two variants are called "blue"", "Variant "de" names exactly one of a country or a continent", "Two variants are for DE", "Variant "de": a CNAME has exactly one value", "Variant "blue": uptime check not found", "A routed set takes health checks per variant, not a failover health check" and "An ALIAS follows its target and cannot be routed".

Geolocation uses IP to Country Lite by DB-IP, licensed under CC BY 4.0.

Did this page help you?