Now that we have the security and user-visits table set up with some data, and know how to write code to query that DynamoDB table, we will write the Lambda Python code.
Creating a Lambda to query DynamoDB
Creating the Lambda function
Now we have the IAM role with two IAM policies attached, create the Lambda function itself. Here, we are creating a function from scratch, as we want to walk through the full details to deepen your understanding of what is involved in creating a serverless stack. The following diagram shows data API architecture involving CloudWatch, DynamoDB, IAM, and Lambda:
Perform the following steps:
- Sign in to the AWS Management Console and open the AWS Lambda console at https://console.aws.amazon.com/lambda/...