Source code for ecstask.osp_eventhandler_v2.utilities.aws_client_util
import boto3
import botocore
client_config = botocore.config.Config(
max_pool_connections=50
)
boto3.set_stream_logger()
[docs]class AWSClientFactory:
dynamodb_resource = None
[docs] @staticmethod
def get_dynamodb_resource(table_name: str):
"""Check is AWS DynamoDB resource object is created or not
else create new AWS dynamodb_resource
Returns:
dynamodb_resource: dynamodb_resource
"""
if AWSClientFactory.dynamodb_resource:
return AWSClientFactory.dynamodb_resource
AWSClientFactory.dynamodb_resource = boto3.resource("dynamodb", config=client_config).Table(table_name)
return AWSClientFactory.dynamodb_resource