Quoting https://aws.amazon.com/de/blogs/compute/container-reuse-in-lambda/
Let’s say your function finishes, and some time passes, then you call
it again. Lambda may create a new container all over again, in which
case the experience is just as described above. This will be the case
for certain if you change your code.
However, if you haven’t changed the code and not too much time has
gone by, Lambda may reuse the previous container. This offers some
performance advantages to both parties: Lambda gets to skip the nodejs
language initialization, and you get to skip initialization in your
code. Files that you wrote to /tmp last time around will still be
there if the sandbox gets reused.
Remember, you can’t depend on a container being reused, since it’s
Lambda’s prerogative to create a new one instead.
As said: You can not depend on the container being reused but there is a good chance when AWS deems it a performance gain.
Or to keep it simpler: AWS probably knows what to do to get your Lambdas as efficient as possible so you should not really overthink this probably.
Also while this blog is aimed at Node.js AWS seems to do something similar for Java based on this post by them.