Specifically I'm interested in using a DynamoDB table object from multiple threads (puts, gets, updates, etc). If that's not safe, then is there a safe way (i.e., maybe one table object per thread)? Any other gotchas or tips about working with threads in boto appreciated.
Boto3 makes it easy to integrate your Python application, library, or script with AWS services including Amazon S3, Amazon EC2, Amazon DynamoDB, and more.
To summarize, resources are higher-level abstractions of AWS services compared to clients. Resources are the recommended pattern to use boto3 as you don't have to worry about a lot of the underlying details when interacting with AWS services. As a result, code written with Resources tends to be simpler.
The maximum duration of the validity of the token is 12 hours (provided it is configured in the role).
Client simply exposes the underlying AWS APIs in a mildly Pythonic way whereas a given boto3 service implementation can expose multiple Resources (e.g. S3 exposes Bucket and Object). They're typically identified by name rather than ARN, in keeping with the high-level nature of the Resource API.
The boto library uses httplib which has never been, and to my knowledge still is not, thread-safe. The workaround is to make sure each thread creates its own connection to DynamoDB and you should be good.
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