Deploy resources(files) rather than functions

I have read Writing Testable AWS Lambda Functions.

So, if I changed logic in class User(users.js), how could I deploy it instead of re-deploy the whole service?

I know I can re-deploy individual function by using sls deploy function -f <function name>,
then, how could I overwrite the same users.js in the latest deployment, as well as the serverless.yml file if made some changes.

Thank you.

Like you mention sls deploy function -f <function name> will update your function code without re-deploying the entire stack.

When a change is made to serverless.yml you will need to run a sls deploy (aka full deploy) to have those new values in serverless.yml take effect

Hi, DavidWells,
Thanks for you reply.

As your said, maybe there is no way to just update serverless.yml but have to deploy all.
How about update other files individually, such as uuid.js, moment.js, _users.j_s and so on?
Those files are changing time and time again, but my functions in handler.js may not change so frequently.

You can’t update a single file in an existing function because AWS doesn’t allow it. You need to deploy a new package with all of the files required by that function.

1 Like

Hi, buggy

It’s so pity, but rule…
I got it, thank you:)