AWS Amplify did not create Lambda@Edge replica in all regions

386 Views Asked by At

I have an AWS Amplify project (with Next.js), which works fine. Nevertheless, most of my users are close to Paris (region eu-west-3), but Cloudfront and Lambda@Edge did not deploy any replicas in this region, but in many other regions, like London (eu-west-3) which handles most of my users instead of Paris.

https://eu-west-3.console.aws.amazon.com/lambda/home?region=eu-west-3#/replicas

"There is no data to display."

https://eu-west-2.console.aws.amazon.com/lambda/home?region=eu-west-2#/replicas

we see all functions created by Amplify with description:

"Replica created by Lambda@Edge."

How can I force Cloudfront and Lambda@Edge to deploy a replica in eu-west-3 ? Ideally via AWS Amplify.

1

There are 1 best solutions below

0
On

I have this same problem (also with Next.js) and after some searching I think the issue is due to the CloudFront Architecture.

Having a CloudFront Edge Locations does not mean it can execute Lambda@Edge functions. Those are only executed at "Regional Edge Caches". The list of locations is here.

So in your situation the closest Regional Edge Caches are: Dublin, Ireland; Frankfurt, Germany; London, England

My users are in South Africa which makes this very interesting because those are the closest to me as well. It means that I should not have put my S3 bucket in af-south-1 because the Lambda@Edge will execute in Ireland anyway - the network round trip will from SA -> CF Edge Location -> Ireland Lambda@Edge -> S3 Bucket in SA -> Ireland -> South Africa

That is a horrible user experience....