Repository navigation
AWS Lambda Deployment Support
π Overview
This release adds full AWS Lambda compatibility, allowing the optimizer to run as a serverless function instead of a continuously running process.
β¨ New Features
-
AWS Lambda Handler - New
lambda_handler.pywith three invocation modes:tomorrow- Optimize for next day (default, ideal for daily 18:00 trigger)today- Re-optimize current dayreactive- Hourly reactive checks
-
Docker Container Image - Production-ready
Dockerfiletargeting AWS Lambda arm64 (Graviton) runtime for better price-performance -
One-Command Deployment -
deploy-lambda.shscript that:- Builds and pushes to Amazon ECR
- Updates Lambda function code
- Configures environment variables
- Sets timeout and memory limits
π§ Improvements
- Lambda-compatible logging - Auto-detects Lambda environment and uses CloudWatch instead of file logging
- Ephemeral cache support - Price cache uses
/tmpin Lambda environments - Environment variable configuration - All secrets loaded from environment variables (no hardcoded values)
π¦ New Files
| File | Purpose |
|---|---|
Dockerfile |
Lambda container image (arm64) |
lambda_handler.py |
Lambda entry point |
deploy-lambda.sh |
Automated deployment script |
.env.example |
Configuration template |
.dockerignore |
Optimized image builds |
βοΈ Configuration
Required environment variables for Lambda:
APP_ID - AlphaESS API app ID
APP_SECRET - AlphaESS API app secret
SERIAL_NUMBER - ESS serial number
π Recommended Lambda Settings
- Architecture: arm64
- Timeout: 30 seconds
- Memory: 256 MB
- Trigger: EventBridge rule at 17:00 UTC daily