Managing dependencies in AWS Lambda involves bundling the required libraries along with your function code. The method varies depending on the runtime (e.g., Node.js, Python) and how you package and deploy your function. AWS also provides features like Lambda Layers to help reuse common dependencies across functions.
Bundle dependencies with your function code and upload as a ZIP file
Use Lambda Layers to separate and share dependencies across functions
Leverage container images for complex applications using custom runtimes
Use package managers (e.g., npm, pip) locally before zipping
Ensure directory structure aligns with runtime expectations (e.g., node_modules, python/)