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.
Context: I’ve set up a Load Balanced Web Service on a public subnet to connect to my OpenSearch cluster in a private subnet, both in the same VPC. The Load Balanced Web Service is a FastAPI application.