Subchapter 91.11
references/splitting-traffic-with-weighted-routing.mdMarkdown11 KBView on GitHub
Domain expertise for splitting DNS responses across two or more endpoints in a defined ratio using weighted records: blue/green deployments, canary releases, A/B testing, and gradual cutover. Covers how weights are interpreted, how to take an endpoint out of rotation safely, health-aware routing for non-AWS targets, and the two distinct zero-weight behaviors.
Does not cover failover routing (a separate skill), latency or geolocation routing, or complex nested Traffic Flow policies.
Execute commands using the AWS MCP server when connected (sandboxed execution, audit logging, observability). Fall back to the AWS CLI otherwise.
To split traffic with weighted records, follow the procedure exactly. See the Procedure section below.
The procedure covers:
Constraints:
| Choice | Use when |
|---|---|
| Zero-weight | The pull is temporary and instant rollback matters (canary abort, blue/green hold). The record stays in place; raising the weight restores traffic |
| Delete | The endpoint is going away for good |
Constraints:
Constraints:
A zero weight behaves in two completely different ways depending on whether all weights are zero and whether health checks are attached. Do not conflate them.
Constraints:
Weights were read as percentages instead of relative shares. Recompute: each share is its weight divided by the sum of all weights.
The record was deleted instead of zero-weighted. Use weight zero to pull traffic while keeping the record.
No health check is attached to the non-alias record. Attach a health check to each non-alias weighted record.
Expected. All-zero is a safety net: Route 53 routes to every record equally. Leave one record nonzero, or delete the records, to actually pull traffic.
The nonzero records have no health checks, so Route 53 never sees them as unhealthy and never falls back. Attach health checks to the nonzero records.
This procedure splits DNS responses across two or more endpoints in a defined ratio using weighted records. It creates one weighted record per endpoint, takes an endpoint out of rotation safely with a zero weight, attaches health checks to non-alias targets, and surfaces the console link to verify.
app.example.com).A).{set_identifier, target, weight} triples, one per endpoint.
set_identifier is a label unique within the weighted group (for example the target value or a
short name); Route 53 requires a distinct SetIdentifier per record in the group.Constraints for parameter acquisition:
Constraints:
aws sts get-caller-identityaws sts assume-role) rather than long-lived IAM user access keys.Constraints:
You MUST create one record per endpoint with the same name and type, each with its own weight
and a unique SetIdentifier:
aws route53 change-resource-record-sets --hosted-zone-id {hosted_zone_id} --change-batch '{
"Changes": [{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": "{record_name}", "Type": "{record_type}",
"SetIdentifier": "{set_identifier}", "Weight": {weight},
"TTL": 60, "ResourceRecords": [{"Value": "{target}"}]
}
}]
}'You MUST remind the customer that weights are relative shares, not percentages
Constraints:
HealthCheckId to each
weighted record, or unhealthy endpoints keep receiving their share. Evaluate Target Health does
not cover non-alias targetsConstraints:
Constraints:
You MUST verify the query distribution matches the intended ratio
You MUST present the records view console link, filling {hostedZoneId}:
https://console.aws.amazon.com/route53/v2/hostedzones#ListRecordSets/{hostedZoneId}{
"hosted_zone_id": "Z1234567890ABC",
"record_name": "app.example.com",
"record_type": "A",
"endpoints": [
{"set_identifier": "primary-192.0.2.10", "target": "192.0.2.10", "weight": 9},
{"set_identifier": "canary-192.0.2.20", "target": "192.0.2.20", "weight": 1}
]
}Created 2 weighted A records for app.example.com (90% / 10% split).
Verify in the console:
https://console.aws.amazon.com/route53/v2/hostedzones#ListRecordSets/Z1234567890ABCWeights read as percentages. Recompute: share = weight / sum of weights (Step 2).
The record was deleted instead of zero-weighted. Use weight zero (Step 4).
No health check on the non-alias record. Attach one to each (Step 3).
aws sts assume-role) rather than
long-lived IAM user access keys, and prefer read-only credentials for inspection steps. Grant
only the specific actions this procedure needs — route53:ChangeResourceRecordSets and
route53:GetChange to create the weighted records and confirm propagation, plus
route53:ListResourceRecordSets and route53:GetHostedZone for inspection — rather than
route53:* or broader service:* wildcards.