Netflix / denominator

Portably control DNS clouds using java or bash
Apache License 2.0
580 stars 110 forks source link

Support ELB failover via Route53 Alias #244

Closed codefromthecrypt closed 11 years ago

codefromthecrypt commented 11 years ago

At Netflix, we'd like to target edge traffic to region-specific Route53 A, AAAA Aliases as opposed to dualstack CNAMEs.

An example CLI command would be the following:

Ex.

$ denominator -n route53 record -z myzone.com. add -t A -n foo.myzone.com. --elb-dnsname abadmin-795710131.us-east-1.elb.amazonaws.com
;; in zone myzone.com. adding to rrset foo.myzone.com. A values: [{HostedZoneId=Z3DZXE0Q79N41H, DNSName=abadmin-795710131.us-east-1.elb.amazonaws.com}]
[Route53#listHostedZones] ---> GET https://route53.amazonaws.com/2012-12-12/hostedzone HTTP/1.1
[Route53#listHostedZones] <--- HTTP/1.1 200 OK (623ms)
[Route53#listResourceRecordSets] ---> GET https://route53.amazonaws.com/2012-12-12/hostedzone/Z3I0BTR7N27QRM/rrset?name=foo.myzone.com.&type=A HTTP/1.1
[Route53#listResourceRecordSets] <--- HTTP/1.1 200 OK (161ms)
[Route53#listResourceRecordSets] ---> GET https://route53.amazonaws.com/2012-12-12/hostedzone/Z3I0BTR7N27QRM/rrset?name=foo.myzone.com.&type=A HTTP/1.1
[Route53#listResourceRecordSets] <--- HTTP/1.1 200 OK (146ms)
[Route53#changeResourceRecordSets] ---> POST https://route53.amazonaws.com/2012-12-12/hostedzone/Z3I0BTR7N27QRM/rrset HTTP/1.1
[Route53#changeResourceRecordSets] <--- HTTP/1.1 200 OK (152ms)
;; ok

denominator could maintain a lookup table for the default elb hosted zone ids, similar to how it is done in fog.

codefromthecrypt commented 11 years ago

Here's the current ELB region mappings:

ELB Region HostedZoneId
us-east-1 Z3DZXE0Q79N41H
us-west-2 Z33MTJ483KN6FU
eu-west-1 Z3NF1Z3NOM5OY2
ap-northeast-1 Z2YN17T5R711GT
ap-southeast-1 Z1WI8VXHPB1R38
sa-east-1 Z2ES78Y61JGQKS
codefromthecrypt commented 11 years ago

cc @colmmacc @allenxwang @coryb

codefromthecrypt commented 11 years ago

In the denominator model, there's 2 ways to approach this.

The special rdata type seems least intrusive, but could result in confusion as record sets with type A or AAAA typically always have rdata with one field: address. If we change this, some tools could possibly break as they'd get null asking for: address. OTOH, if we choose to add a field for the alias target, there'd be no rdata elements, which would break folks in the same way.

I prefer just making a route53-specific Alias rdata type.

codefromthecrypt commented 11 years ago

whoops.. I meant @q

codefromthecrypt commented 11 years ago

In the base route53 denominator tests, we can alias another route53 record to ensure base functionality works. The ELB region mapping table can be scoped to the CLI and mock tested there.

codefromthecrypt commented 11 years ago

issue #245 closes this, and will be merged shortly.