Table of Content
To allow a Lambda function the permissions to interact with a DynamoDB table, you only needs a single line of code.
In the CDK stack file (cdk-workshop-stack.ts
), inside the constructor and below code for UsersListHandler
Lambda function, add the following code:
table.grantReadData(usersList);
Your code should looks like this:
Run cdk diff
to see the change set
cdk diff
Run cdk deploy
to deploy your CDK stack with the IAM permissions.
cdk deploy
Test the UsersListHandler
Lambda function again, the function should be invoked succeeded with a 200
status.