Connecting to Oracle RDS

This post was much helpful for me to use cx_Oracle using Lambda functions. It worked as expected. Thanks for creating this post @Sayed Zainul Abideen

But i got another error from lambda stating 'cx_Oracle.DatabaseError: ORA-24454: client host name is not set'

I got it resolved by adding the below lines in my python code:

import os

with open('/tmp/HOSTALIASES', 'w') as hosts_file:
    hosts_file.write('{} localhost\n'.format(os.uname()[1]))

After which i added below ENVIRONMENTAL VARIABLE to my Lambda function:

HOSTALIASES = /tmp/HOSTALIASES

Hope it helps somebody.

Please add comments if any issues relating to cx_Oracle. I would be happy to help as i struggled a lot to fix this.


I solved this by simply zipping the files properly with the symbolic links

First I created three symbolic links (with respect to above dir structure):

ln -s ./lib/libaio.so.1.0.1 ./lib/libaio.so.1

ln -s ./lib/libaio.so.1.0.1 ./lib/libaio.so

ln -s ./lib/libaio.so.1.0.1 ./libaio.so.1.0.1

ln -s ./lib/libclntsh.so.12.1 ./lib/libclntsh.so

then i was zipping it incorretly I did it like this:

zip --symlinks -r9 ~/lamda.zip *

it worked! properly then.Hope it helps somebody.