Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use MSSQL with AWS Lambda

I am trying to connect to MSSQL database from AWS Lambda (using python) and really struggling to proceed further.

I tried many options with pyodbc, pypyodbc, pymssql they work on local development machine (Windows 7), however AWS Lambda is unable to find the required packages when deployed on AWS. I use ZAPPA for deployment of Lambda package.

I searched through many forums but unable to see the anything moving ahead, any help on this would be highly appreciated.

Many thanks, Akshay

like image 320
akshayp Avatar asked Oct 29 '22 15:10

akshayp


1 Answers

I tried different trial and error steps and ended up with the following one which is working fine in AWS Lambda, I am using PYMSSQL package only.

1) did 'pip install pymssql' on amazon EC2 instance as under the hood Amazon uses Linux AMIs to run their Lambda functions.

2) copied the generated '.so' files* and packaged inside the Lambda deployment package

Below is the folder structure of my lambda deployment package

pymssql-lambda-aws-python

Let me know if you further need help with this.

like image 175
akshayp Avatar answered Nov 15 '22 07:11

akshayp