Can you deploy while lambdas are running

Hi

I had a question that I cant seem to find the answer for.

Given you have AWS Lambdas, along with triggers, queues, etc actively being run.
When you run a serverless deploy, can the lambdas be active and operating, do they complete as the older version, or do you have to disable the triggers and wait for lambdas to complete before running the deploy?
I’m particularly worried about data loss and if the lambdas complete and new calls start the newer lambdas, then it makes our deployments much easier.
We currently disable triggers and cloudwatch events before running the deploy.

Thanks

You can deploy while lambdas are executing, the execution is an invocation of the lambda function at trigger time.

Given a lambda is at v1 and it is invoked, it will spin up a container and start its execution.
When you start a deploy of v2 while v1 it is executing the v1 lambda still runs
Then when the deploy is finished any new invocations will be of the v2 lambda

If you want to ensure no data is lost you should look at having lambda read from an SQS queue, that way if any errors occur in the lambda the payload will be returned to the queue and can be picked up by another invocation

Thanks for that DrColza, its good to have confirmation of what we suspected :slight_smile: