Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

lambda function to query DynamoDB present in another region?

I am wondering if we can write a lambda function in one region for example us-east-1 to query a DynamoDB database present in another region.

I feel that there is a provision. just wondering how the syntax would be to achieve this.

dynamo_client = boto3.resource('dynamodb')
dynamo_table = dynamo_client.Table('table')

Above is a normal example of a dynamodb connection in the same region.

Wondering how would be the syntax when we want to access the dynamodb from another region.

Thank you

like image 267
sumanth shetty Avatar asked Jun 28 '26 10:06

sumanth shetty


1 Answers

Yes, you can. resource takes region_name parameter:

dynamo_client = boto3.resource('dynamodb', region_name='<your-other-regio>')
dynamo_table = dynamo_client.Table('table')
like image 199
Marcin Avatar answered Jul 01 '26 02:07

Marcin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!