Menu

1 / 2

Simple Multi-Region Failover for Amazon Bedrock Using CloudFront and Lambda

DEV Community: serverless·Sulaiman Olubiyi·3 days ago
#HnZNxNfb
#devtoserverless#devto#dev#lambda#bedrock
Long article (1377 words) — no AI summary yet.
Reading 0:00
15s threshold

When you build an app that calls Amazon Bedrock, it is common to deploy everything in one AWS region like us-east-1 . If that region returns errors or starts throttling requests, users see failures until the issue clears.

A straightforward way to add failover without setting up VPCs or load balancers is to deploy the same Lambda function in two regions ( us-east-1 and us-west-2 ) and put Amazon CloudFront in front of both using an Origin Group .

Here is what we will build and test:

Send a request to CloudFront and confirm it is answered by us-east-1 .

Turn on a SIMULATE_OUTAGE=true environment variable in us-east-1 so it returns HTTP 503 .

Send the same request again and confirm CloudFront retries us-west-2 and returns HTTP 200 .

Source code and IAM policies: github.com/Damdev-95/aws-cloudfront-multi-region-bedrock-failover

How it works

With a CloudFront Origin Group , you configure a primary origin ( us-east-1 ) and a secondary origin ( us-west-2 ), along with the HTTP status codes that should…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.