- Minimize deployment package size: use tree-shaking, exclude dev dependencies, prefer ESM for Node.js
- Set memory based on benchmarks — use AWS Lambda Power Tuning to find the cost/performance sweet spot
- Initialize SDK clients and database connections outside the handler to reuse across invocations
- Use Provisioned Concurrency for latency-sensitive endpoints; SnapStart for Java Lambdas
- Avoid synchronous calls to other Lambda functions — use SQS, SNS, or Step Functions instead
- Minimize deployment package size: tree-shaking, exclude dev deps, use Lambda layers for shared code
- Use Lambda Power Tuning to benchmark memory settings — CPU scales linearly with memory allocation
- Initialize SDK clients, DB connections, and config outside the handler for reuse across warm invocations
- Use Provisioned Concurrency for sub-100ms latency requirements; SnapStart for Java cold start reduction
- Avoid synchronous Lambda-to-Lambda calls — use SQS for decoupling, Step Functions for orchestration
- Use ARM64 (Graviton2) runtime for ~20% better price-performance on most workloads
- Batch SQS messages: set batch size 10 and batch window 5s for throughput-oriented processing
- Use Connection pooling for RDS: RDS Proxy for Lambda, or keep-alive settings for direct connections
- Set reasonable timeouts: 10-30s for API handlers, up to 15 minutes for batch/async processing
- Enable X-Ray active tracing to identify slow downstream calls and optimize the critical path
- Use S3 Transfer Acceleration or multipart uploads for large file operations from Lambda