AWS Route53 Geo Location with Failover

amazon-route53amazon-web-servicesdomain-name-systemgeodns

What I currently have is the following
EC2x2 Instance in Tokyo (1 Proxy 1 Application)
EC2x2 Instance in Singapore (1 Proxy 1 Application)

With another another provider we have geo dns, so Tokyo users go to Tokyo instance and Singapore to Singapore.

I'm looking at moving to Route53 (I already have other DNS zones with Amazon) because I'd like to take advantage of the failover with Health Check. Having looked at the examples of how to configure it, I'm still unsure how to configure what I want, which is as follows.

I've configured 2 health checks one for each location, and these are working.
I've configured 2 DNS entries both called proxy.domain.com each with a routing policy of GeoLocation and selected Japan and Singapore and add the relevant EC2 IP to each.
I'm now trying to configure the cname site.domain.com so that if either location is unavailable users will fail over to the other instance.

However what seems to happen is what I also expect to happen. Even when the DNS fails over because the secondary target is the same DNS name as the primary target, the location of the user always wins and the other instance IP is never returned. Example

Japan ip: 1.1.1.1 Singapore ip: 2.2.2.2

From Singapore Ping site.domain.com > 2.2.2.2
Turn off Singapore (Health check confirms unhealthy)
Waiting for TTLs to expire, flushdns.
From Singapore Ping site.domain.com > 2.2.2.2 (At this point I want this to return 1.1.1.1)

Best Answer

What you would need to do is setup an alias tree, similar to How Health Checks Work in More Complex Amazon Route 53 Configurations, and ensuring evaluate target health is set to true.

proxy.domain.com / type geo | location: default -> alias -> wrr.domain.com

proxy.domain.com / type geo | location: Japan -> alias -> japan.domain.com

proxy.domain.com / type geo | location: Singapore -> alias -> sin.domain.com

wrr.domain.com / type wrr | weight 1 --> Japan.domain.com

wrr.domain.com / type wrr | weight 1 --> sin.domain.com

Sin.domain.com / type failover primary | associate with health check

Japan.domain.com / type failover primary | associate with health check

Related Topic