Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

I've created my API with serverless after I deployed my API into a lambda, and we try to test the endpoint via the "Test" button in the GatewayAPI, I get the error:

"User: arn:aws:sts::245912153055:assumed-role/pets-service-dev-us-east-1-lambdaRole/pets-service-dev-listPets is not authorized to perform: dynamodb:Scan on resource: arn:aws:dynamodb:us-east-1:245912153055:table/Pets"

I should probably need to give permission to Lambda, but I'm a little bit lost ...

1 Answer

0 votes
by (44.3k points)

You need to add IAM permission to your serverless definition. Add permissions to your serverless.yml. Check this documentation for more information.

provider:

  iamRoleStatements:

    -  Effect: "Allow"

       Action:

         - "dynamodb:Scan"

       Resource: "arn:aws:dynamodb:us-east-1:245912153055:table/Pets" 

Related questions

Browse Categories

...