
Connecting Lambda To Dynamodb
Wire an AWS Lambda function to DynamoDB with IAM roles, streams, and event source mapping using a step-by-step agent playbook.
Overview
connecting-lambda-to-dynamodb is an agent skill for the Build phase that walks through IAM roles, DynamoDB streams, and event source mapping to connect Lambda to DynamoDB.
Install
npx skills add https://github.com/aws/agent-toolkit-for-aws --skill connecting-lambda-to-dynamodbWhat is this skill?
- End-to-end Lambda–DynamoDB connection procedure with a dedicated reference doc
- IAM execution role setup including AWSLambdaDynamoDBExecutionRole and Lambda trust policy
- DynamoDB stream configuration and event source mapping for trigger-based processing
- Troubleshooting for inactive mappings, permission denied, and timeout/batch-size issues
- Read/write permissions and stream view type guidance for event-driven serverless architectures
- Skill version 1
- Dedicated lambda-dynamodb connection procedure reference document
Adoption & trust: 1k installs on skills.sh; 819 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You want Lambda to react to DynamoDB writes or streams but IAM trust, stream settings, and event source mappings are easy to misconfigure.
Who is it for?
Indie developers deploying serverless handlers on DynamoDB streams or table access patterns who want the agent to follow AWS’s connection SOP.
Skip if: Non-AWS stacks, pure local DynamoDB emulation without cloud deploy, or teams that only need generic CRUD app code with no stream triggers.
When should I use this skill?
Setting up Lambda-DynamoDB integration, processing DynamoDB stream events, or deploying serverless event-driven architectures on AWS.
What do I get? / Deliverables
You get a working Lambda–DynamoDB integration with correct execution permissions, active event source mapping, and concrete fixes when triggers or timeouts fail.
- Configured IAM execution role and trust policy for Lambda
- Active DynamoDB stream and Lambda event source mapping
Recommended Skills
Journey fit
Build is where serverless data pipelines are designed and connected—not where you only react to production alerts. Integrations fits because the skill is entirely about linking Lambda to DynamoDB via IAM, streams, and event source mappings.
How it compares
AWS-focused integration SOP in SKILL.md form—not a generic IaC generator and not a runtime debugger for unrelated services.
Common Questions / FAQ
Who is connecting-lambda-to-dynamodb for?
Solo builders and small teams using AWS Lambda and DynamoDB who need guided setup for streams, IAM, and event source mappings from their coding agent.
When should I use connecting-lambda-to-dynamodb?
Use it in Build while designing serverless integrations—when setting up Lambda-DynamoDB links, processing stream events, or deploying event-driven architectures on AWS.
Is connecting-lambda-to-dynamodb safe to install?
It describes IAM and deploy steps that can change cloud resources; review the Security Audits panel on this page and apply changes in a sandbox account with least-privilege roles first.
SKILL.md
READMESKILL.md - Connecting Lambda To Dynamodb
# Connecting Lambda to DynamoDB ## Overview Domain expertise for connecting AWS Lambda functions to DynamoDB tables, including IAM execution role creation, function deployment, DynamoDB stream configuration, and event source mapping setup. ## Connect a Lambda function to DynamoDB To set up end-to-end Lambda-DynamoDB integration with IAM roles, streams, and event source mapping, follow the procedure exactly. See [Lambda-DynamoDB connection procedure](references/lambda-dynamodb-connection.md). ## Troubleshooting ### Lambda function not triggering Verify the event source mapping is active, DynamoDB streams are enabled with the correct view type, and the execution role has proper permissions. See the full [procedure](references/lambda-dynamodb-connection.md) for details. ### Permission denied errors Check the IAM role has `AWSLambdaDynamoDBExecutionRole` attached and the trust policy allows Lambda to assume it. ### Function timeout issues Increase the timeout setting or adjust the batch size in the event source mapping. # Connect Lambda Function to DynamoDB ## Overview This SOP provides a systematic approach to connect a Lambda function to DynamoDB, including creating the necessary IAM execution role, Lambda function, DynamoDB table with streams, and event source mapping. It enables Lambda to process DynamoDB events and perform read/write operations. ## Parameters - **function_name** (required): The name for the Lambda function - **table_name** (required): The name for the DynamoDB table - **runtime** (optional, default: "python3.12"): The Lambda runtime environment - **aws_region** (optional, default: "us-east-1"): The AWS region where resources will be created - **role_name** (optional, default: "lambda-dynamodb-role"): The name for the IAM execution role - **partition_key_name** (optional, default: "id"): The name of the DynamoDB table's partition key - **partition_key_type** (optional, default: "S"): The type of the partition key - S (String), N (Number), or B (Binary) **Constraints for parameter acquisition:** - You MUST ask for all required parameters upfront in a single prompt rather than one at a time - You MUST support multiple input methods including: - Direct input: Values provided directly in the conversation - Configuration files: JSON or YAML configuration files - You MUST validate that function_name follows AWS Lambda naming conventions (alphanumeric and hyphens only) - You MUST validate that table_name follows DynamoDB naming conventions - You MUST confirm successful acquisition of all parameters before proceeding ## Steps ### 1. Verify Dependencies Check for required tools and warn the user if any are missing. **Constraints:** - You MUST verify the following tools are available in your context: - fs_write - call_aws - You MUST ONLY check for tool existence and MUST NOT attempt to run the tools because running tools during verification could cause unintended side effects - You MUST inform the user about any missing tools with a clear message - You MUST ask if the user wants to proceed anyway despite missing tools - You MUST respect the user's decision to proceed or abort - You MUST verify AWS CLI is properly configured with this command: ``` aws sts get-caller-identity ``` ### 2. Confirm Infrastructure Changes with User Present the planned resources to the user for explicit approval before creating anything. **Constraints:** - You MUST present a summary of ALL resources that will be created: - IAM execution role (${role_name}) - Lambda function (${function_name}) - DynamoDB table (${table_name}) with partition key `${partition_key_name}` (${partition_key_