aws dynamodb ListTables 函数问题

aws dynamodb ListTables functions issue

遇到 Cloudwatch 错误

> AccessDeniedException: User:
> arn:aws:sts::<account_number>:assumed-role/abc-ap-southeast-1-lambdaRole/dev-xxxx
> is not authorized to perform: dynamodb:ListTables on resource:
> arn:aws:dynamodb:ap-southeast-1:<account_number>:table/*\n    at
> Request.extractError
> (/var/runtime/node_modules/aws-sdk/lib/protocol/json.js:52:27)

来自(参考:https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#listTables-property

我已经更新了无服务器中的 IamRoleStatements 以在无服务器文件中添加 ListTables。

有人可以帮我吗?

根据以下文档 link,您的策略的资源类型需要是星号 (*),因为您需要 ListTables 操作, 例如:

iamRoleStatements:
- Effect: "Allow"
  Action:
    - dynamodb:ListTables
  Resource: "*"