What happens if I deploy new version of a lambda while the old one is running?
Is the old one interrupted? Or will the new one be used to handle the next event while the old one runs as if nothing happened?
I can't find docs about it
I posted the same question on the AWS forums and got this reply from AWS dev
It's what you suggest: In-flight invocations complete, without code changes or interruption, using the version of the function that was in place at the time they began. You can potentially have a function change for asynchronous invocations that experience errors or throttles, because a retry will potentially allow a new version of the function to be hit on the next attempt. While we do not abort in-flight invocations, we will aggressively eliminate copies of the old code; this typically happens within a minute of a function being updated. That means that for up to about 5-6 minutes (the max duration of a function, plus a little bit) you can experience either/both versions in use; after that, you should see only the new(ly deployed) version executing.
https://forums.aws.amazon.com/thread.jspa?threadID=270926&tstart=0
The previous version keeps running until it finishes. New invocations after the deployment is completed get the new Lambda version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With