21 lines
504 B
Python
21 lines
504 B
Python
import os
|
|
|
|
import boto3
|
|
|
|
|
|
def get_dynamodb_client():
|
|
running_sam_local = os.getenv('AWS_SAM_LOCAL')
|
|
|
|
if os.getenv('AWS_LAMBDA_FUNCTION_NAME') and not running_sam_local:
|
|
return boto3.client('dynamodb')
|
|
|
|
docker_host = 'host.docker.internal'
|
|
local_host = '127.0.0.1'
|
|
host = docker_host if running_sam_local else local_host
|
|
|
|
return boto3.client('dynamodb', endpoint_url=f'http://{host}:8000')
|
|
|
|
|
|
dynamodb_client = get_dynamodb_client()
|
|
idp_client = boto3.client('cognito-idp')
|