Python Lambda functions for document operations.
Lambda functions are organized by functionality:
authorizer/- Lambda authorizer for API Gateway (JWT validation)upload/- Document upload handler (generates presigned URLs)upload_complete/- Upload completion handler (triggered by S3 via EventBridge)download/- Document download handler (generates presigned URLs)list/- Document list handler (with authorization filtering)delete/- Document delete handlershare/- Document share handlercleanup/- Cleanup handler for abandoned uploads (scheduled daily)common/- Shared utilities (retry logic, structured logging)
authorizer- Validates JWT tokens for all API requestsupload- POST /uploaddownload- GET /download/{document_id}list- GET /listdelete- DELETE /delete/{document_id}share- POST /share/{document_id}
upload_complete- Triggered when objects are created in S3 bucket
cleanup- Runs daily at 2 AM UTC to clean up abandoned uploads
Each Lambda function has its own requirements.txt for dependencies.
Common dependencies include:
boto3- AWS SDKaws-xray-sdk- X-Ray tracingpython-jose- JWT handling (authorizer only)
Property-based tests using Hypothesis are located in each function's directory as test_handler.py.
The common/ directory contains shared utilities:
retry_utils.py- Exponential backoff retry logic for DynamoDBstructured_logger.py- Structured JSON logging for CloudWatch