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…