First, we need a policy allowing the Lambda function to read records from DynamoDB. We can do so by doing the following:
- Sign into the AWS Management Console at https://console.aws.amazon.com/.
- Choose Security, Identity & Compliance | IAM, or search for IAM under Find services.
- In the IAM navigation pane, choose Policies.
- Choose Create policies.
- Choose the JSON tab.
Rather than using the JSON view, you can also use, or switch to, the Visual Editor for creating a policy, but I prefer the JSON view, as the code can be source-controlled and deployed programmatically as we'll do later with the AWS CLI.
- Type, or paste, the following JSON policy document:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": ...