Back to Skills

lambda

verified

AWS Lambda serverless functions for event-driven compute. Use when creating functions, configuring triggers, debugging invocations, optimizing cold starts, setting up event source mappings, or managing layers.

View on GitHub

Marketplace

aws-agent-skills

itsmostafa/aws-agent-skills

Plugin

aws-agent-skills

Repository

itsmostafa/aws-agent-skills
974stars

/skills/lambda/SKILL.md

Last Verified

January 14, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/itsmostafa/aws-agent-skills/blob/main//skills/lambda/SKILL.md -a claude-code --skill lambda

Installation paths:

Claude
.claude/skills/lambda/
Powered by add-skill CLI

Instructions

# AWS Lambda

AWS Lambda runs code without provisioning servers. You pay only for compute time consumed. Lambda automatically scales from a few requests per day to thousands per second.

## Table of Contents

- [Core Concepts](#core-concepts)
- [Common Patterns](#common-patterns)
- [CLI Reference](#cli-reference)
- [Best Practices](#best-practices)
- [Troubleshooting](#troubleshooting)
- [References](#references)

## Core Concepts

### Function

Your code packaged with configuration. Includes runtime, handler, memory, timeout, and IAM role.

### Invocation Types

| Type | Description | Use Case |
|------|-------------|----------|
| **Synchronous** | Caller waits for response | API Gateway, direct invoke |
| **Asynchronous** | Fire and forget | S3, SNS, EventBridge |
| **Poll-based** | Lambda polls source | SQS, Kinesis, DynamoDB Streams |

### Execution Environment

Lambda creates execution environments to run your function. Components:
- **Cold start**: New environment initialization
- **Warm start**: Reusing existing environment
- **Handler**: Entry point function
- **Context**: Runtime information

### Layers

Reusable packages of libraries, dependencies, or custom runtimes (up to 5 per function).

## Common Patterns

### Create a Python Function

**AWS CLI:**

```bash
# Create deployment package
zip function.zip lambda_function.py

# Create function
aws lambda create-function \
  --function-name MyFunction \
  --runtime python3.12 \
  --role arn:aws:iam::123456789012:role/lambda-role \
  --handler lambda_function.handler \
  --zip-file fileb://function.zip \
  --timeout 30 \
  --memory-size 256

# Update function code
aws lambda update-function-code \
  --function-name MyFunction \
  --zip-file fileb://function.zip
```

**boto3:**

```python
import boto3
import zipfile
import io

lambda_client = boto3.client('lambda')

# Create zip in memory
zip_buffer = io.BytesIO()
with zipfile.ZipFile(zip_buffer, 'w') as zf:
    zf.writestr('lambda_function.py', '''
def handl

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
8063 chars