Naeem
Naeem

Reputation: 91

How to avoid deployment of all five functions in a server of serverless framework if only one function is changed

I have a serverless framework service with (say)five aws lambda functions using python. By using github I have created a CodePipeline for CI/CD.

When I push the code changes, it deploys all the functions even only function is changed.

I want to avoid the deployment of all functions and the CI/CD should determine the changed function and deploy it. Rest of functions should not be deployed again.

Moreover, is there anyway to deal with such problems using AWS SAM, as at this stage I have an option to switch towards SAM by quitting serverless framework

Upvotes: 3

Views: 797

Answers (2)

Nadav96
Nadav96

Reputation: 1312

I was also faced this issue, and eventually it drove me to create an alternative.

Rocketsam takes advantage of sam local to allow deploying only changed functions instead of the entire microservice. It also supports other cool features such as:

  • Fetching live logs for each function
  • Sharing code between functions
  • Template per function instead of one big template file

Hope it solves your issue :)

Upvotes: 1

celicoo
celicoo

Reputation: 1118

Unfortunately there is no "native" way to do it. You would need to write a bash that will loop through the changed files and call sls deploy -s production -f for each one of them.

Upvotes: 1

Related Questions