Skip to content
Advertisement

AWS error from Python: No module named lambda_function

I am creating a AWS Lambda python deployment package. I am using one external dependency requests. I installed the external dependency using the AWS documentation. Below is my Python code.

JavaScript

Created the Zip the content of the project-dir directory and uploaded to the lambda(Zip the directory content, not the directory). When I am execute the function I am getting the below mentioned error.

JavaScript

Advertisement

Answer

Error was due to file name of the lambda function. While creating the lambda function it will ask for Lambda function handler. You have to name it Python_File_Name.Method_Name. In this scenario, I named it lambda.lambda_handler (lambda.py is the file name).

Please find below the snapshot. enter image description here

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement