Is boto3 client thread-safe

Andrey Novosad picture Andrey Novosad · Oct 15, 2018 · Viewed 12.1k times · Source

Is boto3 low level client for S3 thread-safe? Documentation is not explicit about it.

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#client

A similar issue is discussed in Github

https://github.com/boto/botocore/issues/1246

But still there is no answer from maintainers.

Answer

Skam picture Skam · Oct 15, 2018

If you take a look at the Multithreading/Processing documentation for boto3 you can see that they recommend one client per session as there is shared data between instance that can be mutated by individual threads.

It also looks like there's an open github issue for this exact question. https://github.com/boto/botocore/issues/1246