Skip to content

AWS Lambda Deployment Support

Choose a tag to compare

@michaelkrasa michaelkrasa released this 09 Dec 17:27
· 15 commits to main since this release

πŸš€ 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.py with three invocation modes:

    • tomorrow - Optimize for next day (default, ideal for daily 18:00 trigger)
    • today - Re-optimize current day
    • reactive - Hourly reactive checks
  • Docker Container Image - Production-ready Dockerfile targeting AWS Lambda arm64 (Graviton) runtime for better price-performance

  • One-Command Deployment - deploy-lambda.sh script 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 /tmp in 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