Boto3 Single Session across the project

How to create a single boto3 session and use it across a python project? Here is the solution: Create session.py Paste the following code: import boto3 import os class Session: session = None def __init__(self): self.get_session() @classmethod def get_session(cls): if cls.session is None: cls.session = cls.start_session() return cls.session @staticmethod def start_session(): if ‘AWS_ROLE_ACCESS_KEY’ in os.environ:continue reading