Explore Courses Blog Tutorials Interview Questions
0 votes
in AWS by (19.1k points)
reopened by

I've looked here and here as I've been trying to work out how to get pymysql running on AWS lambda. The examples I've looked at so far are extremely complex, and with the GitHub tutorial, I got as far as IAM before I started running into permissions errors I didn't know how to solve.

Literally, all I want to be able to do is call import pymysql within the prebuilt AWS lambda console template.

It seems like a simple problem, but I'm having a hard time finding a clear, step-by-step work through how to get new dependencies to work for my lambda function. Ideally, the example would not by via AWS CLI, since apparently there is a console option and this seems like it would take some of the headaches out of the process.

1 Answer

0 votes
by (44.4k points)

Do this:

  • Create a new directory MyPythonLambda and add there.
  • Assume MyPythonLambda/ is main lambda containing handler.

 cd MyPythonLambda/

 pip install redis -t .

 zip -r *

From your local file system or S3, you can upload/import the zip file in lambda creation.

You will have to create a zip file in a similar manner to your to the python mysql library.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

Browse Categories