Where to put boto3.Session creation in my FastAPI application?
I’m debating between either creating a global boto3.Session
for my OpenSearch Python client or creating a new session at the beginning of every endpoint. I can’t find documentation anywhere about when Sessions expire or if they expire. Every boto3.Session()
call is costing me 50ms-100ms in latency, so it’d be great if I could just create a global one and have it never expire. Any guidance would be greatly appreciated.