I have looked all over for a tutorial or help on creating a python3 lambda function from a zip file using the Lambda Management Console on Windows OS. I have, unfortunately, been unlucky. Here is where I am at...
Following the instructions on the AWS website here: https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html
- I create a folder on my desktop called 'APP'. In that folder I save a file with my python code called 'twilio_test.py' at the root level of 'App'.
My Python code:
import twilio
def lambda_handler(event, context):
account_sid = '##########################'
auth_token = '###########################'
client = Client(account_sid, auth_token)
message = client.messages.create(
to = '###########',
from_ = '###########',
body = "Test")
return("success")
- Since I am using the
twilio
library I pip install it in the root of my 'APP' folder based on the instructions found in the above link. The instructions say specifically, "Install any libraries using pip. Again, you install these libraries at the root level of the directory.":
pip install twilio -t \path\to\directory
I then zip the contents of 'APP' based on the quoted instruction, "Zip the content of the project-dir directory, which is your deployment package. Zip the directory content, not the directory." This creates a zip file called 'twilio_test'.
I then go to the AWS lambda management console, upload the zip file 'twilio_test'.
Here is where I am getting confused. What should be the handler?
Have I correctly done everything so far up until this point? If not, what is the best way to go about installing twilio, zipping a file and then using it in AWS lambda?
Although it is inappropriate to say that AWS lambdas are inherently difficult to use, I can say that I am inherently confused.