Skip to content
Skeleton program to get Oracle Instantclient running in an AWS Lambda function.
Python Makefile
Branch: master
Clone or download
Pull request Compare This branch is even with landrey21:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Skeleton program to get Oracle Instantclient running in an AWS Lambda function.

Create an AWS Lambda Function

Login to your AWS console. Go to Lambda's. Create a new, blank lambda function. Name it "pythonOracleTest", and select Runtime Python 2.7.

Add the following encrypted environment variables:


See the code in for reference. The program is using these environment variables to connect to Oracle, instead of a tnsnames.ora file.

Get the Required Libraries

I used an Ubuntu EC2 instance to build the libraries. Go over to your Ubuntu machine for the next steps.


zip and unzip (sudo apt-get install zip unzip)
python 2.7 and pip (google "ubuntu pip install")
make (you can just run the commands in the Makefile if you rather)

Download the Oracle Instantclient

Download the following files from into /tmp/instantclient/:

Get libaio

Run the following command to install it:

sudo apt-get install -y libaio1

Building and Deploying

Clone this repo:

    git clone

    cd aws-lambda-python-oracle

Compile the instantclient and cx_Oracle:


The Makefile expects the zip files to be in /tmp/instantclient. It also assumes you have the awscli installed and can connect. If you don't have the awscli setup you can manually upload the resulting zip. Instead of using "make install", run "make package". This will generate a file called You can upload this file manually in the AWS console, for your lamdba. "make install" will upload the zip file to a lambda function called pythonOracleTest.

make install

Notes: uses the default function "lambda_handler".

You can’t perform that action at this time.