I'm trying to import the yara library into an AWS Lambda function but I am consistently given the following error:
module initialization error: /var/lang/lib/libyara.so: cannot open shared object file: No such file or directory
I have tried adding a layer containing both the requests library and the yara library, importing requests works but importing yara does not.
The lambda function I am working with is as follows. It is doing nothing but importing yara at this stage.
import yara
def lambda_handler(event, context):
return {
'statusCode': 200,
'body': 'Hello from Lambda Layers!'
}
I have also tried creating a virtual environment, installing the packages, creating the lambda function and uploading it to AWS as a lambda function which gives the same error.
You cannot create symlinks in AWS Lambda for /var/lang/lib/libyara.so
because lambda's only permit the writing to /tmp
.
Is there anybody that has got this working?