Reusable Initialization of aiobotocore S3 Client #1110
Unanswered
all4one-max
asked this question in
Q&A
Replies: 1 comment 5 replies
-
so if you're using boto3 you should look into aioboto3. Given it's a singleton you don't need to worry about teardown so you can just do |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm in the process of migrating our Python package, used by various applications within our organization, from boto3 to aiobotocore. In our existing implementation with boto3, we ensure singleton initialization of the S3 client to optimize resource usage and avoid redundant client creation.
Existing Implementation with boto3:
However, transitioning to aiobotocore poses a challenge as it requires using context managers for client creation, and the client doesn't exist outside the context. I aim to encapsulate this singleton logic within our package itself, rather than relying on configuration in the application lifecycle.
I've explored several sources, including the aiobotocore documentation and relevant discussions on GitHub and Stack Overflow, but haven't found a satisfactory solution yet.
Sources referred:
Beta Was this translation helpful? Give feedback.
All reactions