AWS SAM sync keeps deploying all of my functions

36 Views Asked by At

I'm trying to speed up my AWS Lambda deployment by using the sam sync command.

It does sort of what it says it's supposed to do - it kicks off deployments of the code only when I press save. The problem I'm having is that it still deploys ALL my functions, even though I am only touching one line in one lambda.

Here's my setup: Main stack -Substack A (only infra. Also creates two layers that I use in the Lambdas) -Substack B (Lambda 1) -Substack C (Lambda 2-6)

Runtime Node JS (20+) Typescript

When I change something very inconspicious, like adding a character in a console.log command in Lambda 3, sam sync will deploy Lambda 1-6.

What i thought would happen (and would really speed things up) is that only Lambda 3 would be deployed. This is going to be a nightmare once I start adding more lambdas to my solution...

How can I make my sam sync only redeploy only the Lambda I changed code in? (or at least a minimum of impacted Lambdas if I change common code)

I have tried to narrow the scope of what sam sync is looking at by adding the --code and --resource-id Lambda 3 paramters to the sync command.

0

There are 0 best solutions below