unixODBC in AWS Lambda function

aws

#1

Hi everybody,
I have been looking around for this for some time and I always found dead ends.
Before bypassing Serverless and starting building functions manually, I would like to know if anyone in this forum can help.

My issue is related to a ODBC driver for Amazon Linux that I need for my stack to work.
I can’t find any command, flag or setting that allows me to install unixODBC on deploy or include it properly in the .zip package generated by Serverless.
I can include any pip package I need through serverless-python-requirements, but the driver I need (unixODBC) can be installed with yum through the command yum install unixODBC.

I experimented with lambci/docker-lambda to reproduce locally the same AMI linux environment used by AWS Lambda: my program worked flawlessly after installing dependencies, but I am wondering how do I include the needed libraries (that resides in /usr/lib64 in the AMI Linux environment) inside my .zip package before uploading it with Serverless.

I am also trying to understand how to use the serverless-python-requirements setting dockerizePip:true which is poorly documented but hints to the right direction (get files and configuration from docker-lambda docker containers).

I really would like to know what’s the best way to approach this and if anyone can point me to the right solution or strategy,

Thank you very much for your attentions,
Andrea


#2

Did you ever find a solution?. I have the exact same issue.


#3

Hai,
Thanks for sharing your question. You can run odbcinst -j and check where the driver ini file is located (odbcinst.ini) so you can set the path there. Otherwise create the new one at ~/.odbcinst.ini which can define the path to SQL ODBC driver library.
From the response it looks like everything is running OK except for the unixODBC manager cannot find the driver on Amazon Web Services Lambda Instance