2

I'm trying to use pycrypto and lambda service, but every time that i run my script lambda service return:

Unable to import module 'service': /var/task/Crypto/Cipher/_AES.so: invalid ELF header

I don't know why is happen if someone have the same problem, please help me.

Thank you everyone.

2 Answers 2

1

I ran into this same issue, had to build my deployable zip on a Linux VM.

As alex-luminul comments in this issue, it may be due to the OSX-compatible shared library _AES.so being sent to Lambda, where Lambda requires Linux compatible shared libraries.

Sign up to request clarification or add additional context in comments.

Comments

0

There are some people who have pre-compiled some python packages for use in AWS Lambda. For example the pip package lambda_packages and a GitHub repository called awslambda-pycrypto.

I picked the latter since I only needed PyCrypto in my function. To use it, I downloaded the awslambda-pycrypto repository and then put the files in a directory named "modules", and then I loaded the code like so:

import sys
sys.path.insert(0, "./modules")
from Crypto.Cipher import AES

You then have to zip the directory that contains your function and upload it to Lambda.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.