[handler].zip
data "archive_file" "lambda_zip" { type = "zip" source_file = "${path.module}/src/handler.py" output_path = "${path.module}/dist/handler.zip" } Use code with caution. Copied to clipboard : Points to your raw script (e.g., src/handler.py ).
: Use build scripts (like build.gradle or package.json scripts) to install dependencies into a temporary folder before the final ZIP command to ensure a "clean" environment [8]. [handler].zip
: Automatically packages files into a .serverless directory, often naming the primary artifact based on the function name, though it can be manually specified as handler.zip in the serverless.yml [8]. 4. Best Practices data "archive_file" "lambda_zip" { type = "zip" source_file
A standard handler.zip package contains the source code and all necessary dependencies required for the function to execute. For a Python-based Lambda, the structure usually looks like this: the structure usually looks like this: