Lambda Handler — Project Example¶
A functualize project deployed as AWS Lambda functions. Demonstrates both "fat Lambda" (single function with routing) and "thin Lambda" (one function per job) patterns.
Source¶
plugins/adapters/functualize-lambda/examples/lambda_handler/
Setup¶
Deployment Patterns¶
Fat Lambda¶
Single Lambda function that routes internally:
from lambda_service.app import fat_handler
def handler(event, context):
return fat_handler(event, context)
Event: {"job": "process_order", "kwargs": {"order_id": "ORD-123", "amount": 49.99}}
Thin Lambda¶
One Lambda per job for simpler IAM and monitoring:
Key Concepts¶
JobSources(functions=[...])— Explicit registration (no filesystem scanning for fast cold starts)LambdaAdapter— Translates Lambda events to job executiontwelve_factor()— Env vars only (Lambda has no filesystem config files)make_handler(name)— Creates a per-job Lambda handler function- Testable locally — Jobs work without AWS; test with plain function calls
Testing Locally¶
uv run pytest tests/ -v
# Or simulate a Lambda invocation
python -c "
from lambda_service.app import fat_handler
result = fat_handler({'job': 'process_order', 'kwargs': {'order_id': 'ORD-001', 'amount': 99.99}}, None)
print(result)
"
Related¶
- HTTP Service Example — Same pattern with HTTP adapter
- Plugins Guide