Are AWS Lambdas serially reusable and thread-safe? In other words, can I use class fields to maintain state while the Lambda is running. I don't intend to re-use the state. Any field variables would be re-used and re-set at the next invocation. I just want to make sure that my Lambda won't be executed by multiple threads at the same time.
Asked
Active
Viewed 32 times
0
-
[aws-lambda-and-java-concurrency](https://stackoverflow.com/questions/38016683/aws-lambda-and-java-concurrency) – Mohamad Ghaith Alzin Sep 18 '22 at 00:14
-
That helps, but is doesn't seem very definitive for the question I'm answer, especially with all the varying opinions. It sure looks like the answer is yes – Peter Kronenberg Sep 18 '22 at 15:40
1 Answers
1
Yes, Lambda scales horizontally. It will spin up multiple instances but a particular Lambda is only in use by a single caller at a particular time. Multiple callers would get multiple Lambdas.

stdunbar
- 16,263
- 11
- 31
- 53
-
Sorry but do not you think that it is better to put some related links to the answer? – Mohamad Ghaith Alzin Sep 19 '22 at 00:06