aws-sdk
有没有办法通过使用 javascript或dynamoose
npm 包在 DynamoDB 区域之间动态切换?
假设 2 个表存在于孟买 (ap-south-1) 和法兰克福 (eu-central-1) 两个不同的区域。最初,当应用程序启动时,它使用 ap-south-1,然后经过一些业务逻辑,它需要将数据库实例路由到 eu-central-1。
那么,如何通过使用 javascript aws-sdk 或 dynmoose 包来实现它。
现在,我正在使用下面的代码片段。但它不工作
import dynamoose from 'dynamoose';
dynamoose.AWS.config.logger = console;
dynamoose.AWS.config.update({ region: 'ap-south-1'}); // working here
// some business login
// ...
// ...
// switch DynamoDB region
dynamoose.AWS.config.update({ region: 'eu-central-1'}); // but it's not working. Not even throwing any error.
有人可以帮忙吗?有没有办法记录运行特定查询的 AWS Dynamodb 区域?就像启用 AWS 记录器一样,它只是输出
[AWS dynamodb 200 0.042s 0 retries] getItem({ TableName: 'User', Key: { userId: { S: '99999' } } })