AWS Lambda Layer: No module named 'psycopg2._psycopg'"

Viewed 28

I have a library that I downloaded here:

psycopg2

I tried all stakeoverflow suggestions thus far but they didn't work.

I placed it in a folder like this then zipped it to a python.zip folder on windows. The libraries inside are unzipped.

enter image description here

Then I created a lambda layer like this:

enter image description here

I've made sure that the runtime for layer and the function are the same, can someone please assist? Been struggling with this for more than a day.

2 Answers

You need To compile it within a similar architecture as the lambda runtime. I would log into an Amazon Linux EC2 install psycopg there into a specific directory, then copy those files to your Lambda layer on your Windows machine.

Can send more specific steps if you need.

Related