How it works...

In this recipe, we are taking a single service and deploying it to two regions—us-east-1 and us-west-2. From the perspective of the API Gateway and the Lambda function, we are simply just creating two different CloudFormation stacks, one in each region. We have two scripts—dp:lcl:e and dp:lcl:w, and the only difference between the two is that they specify different regions. As a result, the effort to deploy to two regions is marginal, and there is no additional cost because we only pay per transaction. One thing of note in the serverless.yml file is that we are defining the endpointType for the API Gateway as REGIONAL, which will allow us to leverage the Route53 regional routing capabilities:

As shown in the preceding diagram, ...

Get JavaScript Cloud Native Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.