James DC
James DC

Reputation: 50

How to deploy AWS Lambda using Codepipeline without rebuilding it if there are no function code changes?

so we have a pipeline that zips code functions for our Lambda, uploads it to S3 and builds the every lambda we have again with new version of zipped codes.

Now, the problem is, every single Lambda is being Built every pipeline run. even if there are no changes to other lambda code function. ex. (only 1 of 10 lambda has code change)

What would be the best approach or checking that we need to add in our pipeline in order to build the only Lambda that has code change? open for any suggestions even creating new pipeline and breaking this lambdas into pieces

Upvotes: 1

Views: 479

Answers (2)

Dave
Dave

Reputation: 888

What we do at our company is have a single pipeline per lambda / repo. We have a few mono repos that when they deploy they deploy all the lambdas in that repo at once but still through a single pipeline. If you concerned about cost in the pipeline sticking around you could always delete them and then have another job to recreate them when you need to feploy a new change.

We've got everything done through cloud formation scripts so it's all simple scripts running here and there to create pipelines.

Curious what is the reason to have one pipeline deploy all 10 lambdas?

Upvotes: 0

Saggi Bashari
Saggi Bashari

Reputation: 436

I think the best way is to add a stage before the zipfile to see with files changes in the code in the last merge.

Simply take those names and check which lambda was affected.

Then it will pass the list of lambdas need to redeploy.

Upvotes: 1

Related Questions