I'm trying to create a deployment package for AWS Lambda but no matter what I do I can't get it to run. Here's my process:
1) Launch AWS EC2 instance from the AMI linked here
2) Use Pip3 to install all my dependencies to a local folder with Python 3.6 installed via Yum.
3) FTP the dependencies to my local computer and zip it with my python file.
My folder structure INSIDE zip: 
The exact code I'm trying to call is the "handler" method inside of login.py. This is how my Lambda function is set-up: 
Lastly, here is the actual error message I receive, I've done everything I think of can't seem to figure this out: 
Any help greatly appreciated!!
EDIT: Here's the python code:
import sys
import logging
import rds_config
import bcrypt
import pymysql
#rds settings
rds_host = "xxx"
name = rds_config.db_username
password = rds_config.db_password
db_name = rds_config.db_name
logger = logging.getLogger()
logger.setLevel(logging.INFO)
try:
conn = pymysql.connect(rds_host, user=name, passwd=password, db=db_name, connect_timeout=5)
except:
logger.error("ERROR: Unexpected error: Could not connect to MySql instance.")
sys.exit()
logger.info("SUCCESS: Connection to RDS mysql instance succeeded")
def handler(event, context):
accountData = None
accountEmail = event['userEmail']
accountPassword = event['userPassword']
with conn.cursor() as cur:
sql = "SELECT `id`, `email`, `password` FROM `accounts` WHERE `email`=%s"
cur.execute(sql, ('[email protected]'))
accountData = cur.fetchone()
if accountData['email'] == accountEmail:
if bcrypt.hashpw(password, accountData['password']) == accountData['password']:
print('Returning Account Id: ' + str(accountData['id']))
return accountData['id']
else:
print("Invalid Credentials")
return "Invalid Credentials"
