Search code examples
node.jsaws-lambdaamazon-dynamodbamazon-cloudwatchserverless

aws dynamodb ListTables functions issue


Got following Cloudwatch error

> 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)

from (referred : https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#listTables-property)

enter image description here

I have already updated IamRoleStatements in serverless to add ListTables in serverless file. enter image description here

Can someone please help me?


Solution

  • Based on the following documentation link, the resource type of your policy need to be asterisk (*) since you need ListTables action, for example:

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