Ritul Patel

Software Engineer III

Home

Refreshable Boto3 Session

Published Aug 01, 2020

Purpose of this post is to show how to leverage botocore library to create refreshable boto3 session.

There are many good reason to use refreshable boto3 session. One common scenario is that in order to reduce https latency when creating boto3 connections, people might cache client or resource object. But if we don’t use refreshable boto3 session, we might run into issue where credentials might have expired and then any boto3 call will fail with expired token error.

Link to PyPi

Here’s how you can do that:

Code

Download