Multiple Cloudfront Distributions with Lambda@Edge


Going through the new cloudFront Lambda event documentation, I see that the way you are able to link a Lambda@Edge function with a CloudFront Distribution declared in the CloudFormation Resources section in the serverless.yml file is by using CloudFrontDistribution as it’s logical name.

Is that the only way? If so, that means your limited to using a single Distribution for all the Lambda@Edge functions declared in a project.

Is there another way to use more than 1 Distribution in a project?



I would also like to connect one Lambda function to multiple CloudFront distributions.
Would be nice with more advanced examples too.

1 Like

Hi, did you find out if its possible? Have thesame issue. Want to use multiple cloudfront for staging

I am also curious if you have found an answer. I’d like to be able to use serverless to add a lambda at edge function to an existing Cloudfront distribution. The documentation doesn’t make it seem like it works that way.

I wasn’t able to use multiple CloudFront distributions using the native Serverless Framework event.

Instead, I was able to do it using this Serverless Plugin: @silvermine/serverless-plugin-cloudfront-lambda-edge

I would have preferred to achieve it with the native event, but the plugin works well nonetheless.