An Easier Way to Do Multi-Region AWS Serverless Framework Deployments

Discover the essentials of optimizing Serverless Framework applications for a global audience with multi-region deployments with StratusGrid’s enhancements.

Subscribe

Subscribe

The Need for Multi-Region Deployments

Until recently, deploying your Serverless Framework application in multiple regions was a somewhat difficult process involving a lot of custom CloudFormation. However, StratusGrid recently submitted changes to serverless-domain-manager that make it much simpler.

The following architecture can be created with simple configuration changes:

An Easier Way to Do Multi-Region AWS Serverless Framework Deployments 2

 

Why Are Multi-region Deployments Important?

Serverless Framework deployments are generally created in a single region in Amazon Web Services (AWS). This may work if you are only targeting a single part of the world, but if your application is intended for a global audience, your response time can be unacceptably long for users who are far away from your deployment region. A multi-region deployment with latency-based routing can reduce response times from multiple seconds to double-digit milliseconds!

Multi-region deployments are also great from a disaster recovery and redundancy perspective. Automated health checks and a failover policy can be configured to achieve an active-active setup that can fail over between regions in the event of any issue. 

This is particularly useful for situations such as the us-east-1 outage on December 7, 2021 , where services were unavailable for nearly 8 hours in us-east-1, while other regions remained unaffected.

Lambdas in Multi-Region Deployments

Lambdas are well suited for multi-region deployments because they can easily scale and adapt to varying traffic patterns without incurring unnecessary costs. Operating within the pay-as-you-go model makes them much more economically appealing than other computing options - they can result in wasted and idle resources.

Implementing Multi-Region Deployments With serverless-domain-manager

At StratusGrid, we use the popular (and excellent) plug-in serverless-domain-manager to create the custom domain and Route 53 records. We recently submitted a change to the repository that makes it possible to perform multi-region deployments with minimal configuration changes.

To get started, add the serverless-domain-manager configuration to your `serverless.yaml` file as usual. The only difference is that you now add a `route53Params` structure with a `routingPolicy: latency` property.

An Easier Way to Do Multi-Region AWS Serverless Framework Deployments 3

Then update your deployment process to deploy to multiple regions:

An Easier Way to Do Multi-Region AWS Serverless Framework Deployments 4

Example

Check out this github repository for an example of a multi-region project.

Results

We can demonstrate latency reductions by creating a simple lambda from the demo repository and deploying it to a single region. In this case, I deployed it to ap-southeast-1, which is far away from my machine located in the eastern United States. Making 10 requests I get the following total response times in seconds:

An Easier Way to Do Multi-Region AWS Serverless Framework Deployments 5

Deploying the same project again in us-east-1, I get these response times with the exact same domain:

An Easier Way to Do Multi-Region AWS Serverless Framework Deployments 6

Deploying your Serverless Framework applications in multiple regions is a cost-effective and easy way to improve your users’ experience while increasing your application’s resiliency. We encourage you to consider this pattern for all of your Serverless deployments.

StratusGrid Can Help With Multi-region Deployments

Embrace the future of application deployment with StratusGrid's expertise in multi-region serverless frameworks. Ensure your application delivers optimal performance worldwide, reducing latency and enhancing user experience, while bolstering disaster recovery and redundancy. Our enhancements to serverless-domain-manager simplify the deployment process, allowing you to focus on innovation rather than infrastructure.

Contact us today to elevate your serverless applications to a global scale with our proven multi-region deployment strategies.

BONUS: Find Out if Your Organization is Ready for The Cloud ⤵️

FinOps

Similar posts