Reputation: 153
My Python code that works on my local machine and on a AWS Ubuntu box uses MySQL Connector with:
import mysql.connector
On my local Mac I installed from the disk image downloaded from https://dev.mysql.com/downloads/connector/python/
And on my Ubuntu box on AWS, I pip'ed it via: Python3 pip –m mysql-connector
So, now that I want to place the Python function into an AWS Lambda function, the TEST of the function is yielding:
Unable to import module 'myapp': No module named 'mysql'
I don't know if I want to move to the documented pymsql found at https://docs.aws.amazon.com/lambda/latest/dg/vpc-rds-deployment-pkg.html
I really just want to port my code over to Lambda and not have to make any changes to access my RDS MySQL instance. Step by step, please...
Upvotes: 2
Views: 1373
Reputation: 153
The libraries for MySQL must be pip'ed to the project directory and then zipped up into the same archive file that contains the code for the handler (in my case Python).
Upvotes: 1