diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index 77f9aabced0..039db119cb0 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -193,6 +193,7 @@ class DynamoDBArgs(LiteLLMBase): billing_mode: Literal["PROVISIONED_THROUGHPUT", "PAY_PER_REQUEST"] read_capacity_units: Optional[int] = None write_capacity_units: Optional[int] = None + ssl_verify: Optional[bool] = None region_name: str user_table_name: str = "LiteLLM_UserTable" key_table_name: str = "LiteLLM_VerificationToken" diff --git a/litellm/proxy/db/dynamo_db.py b/litellm/proxy/db/dynamo_db.py index a5c4b8371f3..73e20054976 100644 --- a/litellm/proxy/db/dynamo_db.py +++ b/litellm/proxy/db/dynamo_db.py @@ -71,9 +71,15 @@ class DynamoDBWrapper(CustomDB): from aiodynamo.models import ReturnValues from aiodynamo.http.aiohttp import AIOHTTP from aiohttp import ClientSession + import aiohttp verbose_proxy_logger.debug("DynamoDB Wrapper - Attempting to connect") - async with ClientSession() as session: + # before making ClientSession check if ssl_verify=False + if self.database_arguments.ssl_verify == False: + client_session = ClientSession(connector=aiohttp.TCPConnector(ssl=False)) + else: + client_session = ClientSession() + async with client_session as session: client = Client(AIOHTTP(session), Credentials.auto(), self.region_name) ## User try: @@ -145,8 +151,13 @@ class DynamoDBWrapper(CustomDB): from aiodynamo.models import ReturnValues from aiodynamo.http.aiohttp import AIOHTTP from aiohttp import ClientSession + import aiohttp - async with ClientSession() as session: + if self.database_arguments.ssl_verify == False: + client_session = ClientSession(connector=aiohttp.TCPConnector(ssl=False)) + else: + client_session = ClientSession() + async with client_session as session: client = Client(AIOHTTP(session), Credentials.auto(), self.region_name) table = None if table_name == "user": @@ -178,8 +189,14 @@ class DynamoDBWrapper(CustomDB): from aiodynamo.models import ReturnValues from aiodynamo.http.aiohttp import AIOHTTP from aiohttp import ClientSession + import aiohttp - async with ClientSession() as session: + if self.database_arguments.ssl_verify == False: + client_session = ClientSession(connector=aiohttp.TCPConnector(ssl=False)) + else: + client_session = ClientSession() + + async with client_session as session: client = Client(AIOHTTP(session), Credentials.auto(), self.region_name) table = None key_name = None @@ -232,8 +249,13 @@ class DynamoDBWrapper(CustomDB): from aiodynamo.models import ReturnValues from aiodynamo.http.aiohttp import AIOHTTP from aiohttp import ClientSession + import aiohttp - async with ClientSession() as session: + if self.database_arguments.ssl_verify == False: + client_session = ClientSession(connector=aiohttp.TCPConnector(ssl=False)) + else: + client_session = ClientSession() + async with client_session as session: client = Client(AIOHTTP(session), Credentials.auto(), self.region_name) table = None key_name = None diff --git a/litellm/proxy/proxy_config.yaml b/litellm/proxy/proxy_config.yaml index 1216b68dcaa..c464deaebdc 100644 --- a/litellm/proxy/proxy_config.yaml +++ b/litellm/proxy/proxy_config.yaml @@ -55,7 +55,8 @@ general_settings: database_type: "dynamo_db" database_args: { # 👈 all args - https://github.com/BerriAI/litellm/blob/befbcbb7ac8f59835ce47415c128decf37aac328/litellm/proxy/_types.py#L190 "billing_mode": "PAY_PER_REQUEST", - "region_name": "us-west-2" + "region_name": "us-west-2", + "ssl_verify": False }