Comprehensive developer toolkit implementing serverless best practices for AWS Lambda functions in Python
89
A Lambda function that processes events from multiple AWS services and extracts relevant data in a type-safe manner.
@generates
def process_sqs_event(event: dict) -> list[dict]:
"""
Process SQS event and extract message details.
Args:
event: Raw SQS event dictionary
Returns:
List of dictionaries containing:
- body: Message body as string
- receipt_handle: Receipt handle for the message
- attributes: Message attributes dictionary
"""
pass
def process_s3_event(event: dict) -> list[dict]:
"""
Process S3 event and extract object details.
Args:
event: Raw S3 event dictionary
Returns:
List of dictionaries containing:
- bucket: Bucket name
- key: Object key (URL-decoded)
- event_name: Event name (e.g., 'ObjectCreated:Put')
"""
pass
def process_dynamodb_event(event: dict) -> list[dict]:
"""
Process DynamoDB stream event and extract record details.
Args:
event: Raw DynamoDB stream event dictionary
Returns:
List of dictionaries containing:
- event_name: Event name (INSERT, MODIFY, REMOVE)
- new_image: New image as native Python dict (None for REMOVE)
- old_image: Old image as native Python dict (None for INSERT)
"""
pass
def process_apigateway_event(event: dict) -> dict:
"""
Process API Gateway REST event and extract request details.
Args:
event: Raw API Gateway REST event dictionary
Returns:
Dictionary containing:
- method: HTTP method
- path: Request path
- query_params: Query string parameters as dict
- user_agent: User-Agent header value (case-insensitive lookup)
"""
passProvides type-safe event source data classes for AWS Lambda events.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/pypi-aws-lambda-powertoolsdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10