Problem
My Lambdas deployed on AWS have used boto3 clients/resources before with only the service name, however Lambdas deployed inside Localstack only work when region_name
, aws_access_key_id
, aws_secret_key_id
, and endpoint_url
.
How do I remove the need for this?
What I've tried
I've tried deploying the Lambda inside Localstack without the extra parameters but I get errors such as:
Exception: ('Unable to get handler function from lambda code.', NoRegionError('You must specify a region.',))
and
botocore.exceptions.ClientError: An error occurred (UnrecognizedClientException) when calling the Scan operation: The security token included in the request is invalid.
What I want
Ideal situation (as it is in my current Lambdas on AWS):
dynamodb = boto3.client('dynamodb')
The current work-around (when deploying to Localstack):
dynamodb = boto3.client('dynamodb', region_name='eu-west-2',
aws_access_key_id="", aws_secret_access_key="",
endpoint_url='http://localhost:4569')