Richard in Aws 5 minutes

Automating Route53 Failover S3

Utilising Route 53 DNS Failover with S3 Hosting is a smart idea for website resiliency in a disaster scenario (or temporary platform unavailability!).

Let’s start with a Route53 Hosted Zone File including three records. NS, SOA by default and a single A Record perhaps pointing to an EC2 instance or alias to a load balancer.

My helpful screenshot

Now create a healthcheck where we can point to a cloudwatch alarm. Something like count of active nodes on an ELB or lack of HTTP500 status checks make sense.

My helpful screenshot

Modify your A record ttl to 60seconds, Routing Policy of “Failover”, Failover type to “Primary” and associate with the healthcheck created in the step above.

My helpful screenshot

Add a second A Record, ttl 60seconds, Routing Policy of “Failover”, Failover type to “Secondary”, evaluate target health to “No”, Associate with Health Check “No”.

My helpful screenshot

The result should look like this

My helpful screenshot

And finally health check should appear green, it’s a good idea to test the whole failover process by inverting the status on the healthcheck to simulate a downtime event and then revert back to healthy status.

My helpful screenshot Happy days.