| Method | Size Limit | Use Case |
|---|---|---|
| ZIP (direct) | 50MB zipped, 250MB unzipped | Small functions |
| ZIP (via S3) | 50MB zipped, 250MB unzipped | Larger packages |
| Container Image | 10GB | Complex dependencies |
| Layers | 250MB total (5 layers) | Shared libraries |
pip install -r requirements.txt -t ./package
cp lambda_function.py ./package/
cd package && zip -r ../function.zip .
FROM public.ecr.aws/lambda/python:3.12
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY app.py .
CMD ["app.handler"]
Exam Tip: ZIP max 250MB unzipped. Container max 10GB. Layers for shared deps. S3 upload for packages > 50MB.