Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you update a CloudFront distribution Lambda@Edge reference based on a CodePipeline build?

My situation is:

  1. I have a CloudFront distribution managed by CloudFormation that, amongst other things, needs to pass certain requests to an Edge Lambda.

  2. I have a CodePipeline that builds new versions of my Lambda function based on repository commits.

  3. I need to update the Lambda ARN in my CloudFront distribution whenever this lambda gets re-built to point to the new version.

So, I somehow need to reference the latest Lambda version in my CloudFormation template, and trigger CloudFormation to update my distribution whenever the CodePipeline builds a new version. Is it possible to do that passively? Do I have to write some new function to actively force a re-build? Is there another pattern for this I'm not aware of?

like image 879
DougW Avatar asked Jan 19 '26 16:01

DougW


1 Answers

I managed to find the answer to my question. Basically, the scenario I describe is a known limitation of CloudFront + Edge Lambdas and there is currently no AWS solution.

Here is a link to the relevant issue discussion thread. There are a few references to third-party plugins to help deal with this problem.

https://github.com/serverless/serverless/issues/3944

like image 97
DougW Avatar answered Jan 22 '26 11:01

DougW



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!