connecting-lambda-to-dynamodb

Connect AWS Lambda to DynamoDB with IAM roles and stream mappings.

Updated May 12, 2026
One-click install
npx skills add https://github.com/mreferre/aws-agent-toolkit-skills --skill connecting-lambda-to-dynamodb-mreferre
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: connecting-lambda-to-dynamodb
Source: https://github.com/mreferre/aws-agent-toolkit-skills/tree/main/.kiro/skills/connecting-lambda-to-dynamodb
Command: npx skills add https://github.com/mreferre/aws-agent-toolkit-skills --skill connecting-lambda-to-dynamodb-mreferre

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

You need a reliable, repeatable way to connect an AWS Lambda function to DynamoDB so that stream events can automatically trigger processing with the correct IAM permissions.

Core Features & Use Cases

  • Creates IAM execution role for DynamoDB access and logging: Sets up the trust policy and attaches the AWSLambdaDynamoDBExecutionRole managed policy so Lambda can assume the role and write to CloudWatch.
  • Deploys a DynamoDB-stream-triggered Lambda function: Produces a Python Lambda handler for processing DynamoDB stream records with logging and error handling.
  • Configures DynamoDB streams and event source mapping: Enables DynamoDB streams with NEW_AND_OLD_IMAGES and creates an event source mapping (batch size 100, starting position LATEST) to route stream events to the function.

Quick Start

Ask the assistant to connect your Lambda function to your DynamoDB table (including IAM role, streams, and event source mapping) using the provided procedure and then verify the setup by invoking the function with a sample stream event.

Frequently Asked Questions about connecting-lambda-to-dynamodb

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I trigger an AWS Lambda function from DynamoDB streams?

To trigger an AWS Lambda function from DynamoDB streams, enable streams with NEW_AND_OLD_IMAGES on your table and create an event source mapping to route the stream events to the function.

What IAM permissions does Lambda need to read DynamoDB streams and write to CloudWatch logs?

Lambda needs an execution role with a trust policy allowing it to assume the role, plus the AWSLambdaDynamoDBExecutionRole managed policy for DynamoDB stream access and CloudWatch log writing.

What is the best way to configure event source mapping for a serverless DynamoDB stream?

Configure the event source mapping with a batch size of 100 and a starting position of LATEST to route DynamoDB stream events to your Lambda function for serverless event-driven processing.

Why is my DynamoDB stream not triggering my Lambda function?

Your DynamoDB stream may not trigger Lambda if the event source mapping status is not active, or if streams are not enabled with NEW_AND_OLD_IMAGES on the table.

Do I need to enable DynamoDB streams before connecting an event-driven Lambda function?

Yes, you must enable DynamoDB streams with NEW_AND_OLD_IMAGES on your table before creating the event source mapping to ensure Lambda receives both before and after item images.

Can I use a Python Lambda handler to process DynamoDB stream records with error handling?

Yes, you can deploy a Python Lambda handler designed specifically for processing DynamoDB stream records, which includes built-in logging and error handling capabilities.