(Part 1 of a series)
Building active-active in multiple regions can be expensive and complex. Serverless-native applications can make it simpler to serve users globally and enable more effective recoveries with less effort.
Starting from the end user making an http request and assuming there are two identical instances of an application running in two AWS regions - this and next several posts will discuss considerations, tools and solutions for building serverless active-active architectures.
The first touchpoint for a request is DNS routing. This where the cloud DNS (AWS Route53) connects the request to your application's endpoints - in whatever region they are in the world.
AWS Route53 lets you select a routing policy for DNS records. A regional policy will route users the closest geographic region ($0.70 per million queries). A latency policy will route to the the lowest query latency record ($0.60 per million queries). For high traffic web services, the TTL value should be considered as most web clients cache dns for the specified TTL.
If the record is configured as an alias to an AWS service (like cloudfront and api gateway) - the dns queries are free.
If a region is down (and it's not even your fault), Route53 does not know not to send requests there. To make Route53 know the state of an endpoint, health checks can be configured. Depending on the config, a health check is somewhere between $0.50 - $2.00 per month. Two ways to configure a health check are:
Here the TTL is a more important consideration - since clients will cache dns - faster health-check polling intervals will not give you instantaneous routing switchover. So if users are actively using a service at the moment the switch over happens, you should have the expectation that they may still be hitting the failing endpoint until their dns cache expires.
The next few posts will discuss these and other considerations, approaches and dirty hacks for building a low overhead active-active strategy with serverless on AWS:
Enter your email If you would like to get an email the next time we post.
We post about ~1-2x per month, and up to once a month about company news.
Fork and deploy a hello world project onto Cyclic faster than it has taken to read this page. Experience the power.Deploy on Cyclic 🚀