You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Turns out, Python modules with .so libraries installed via pip will probably not work when ran on Lambda. This makes sense but it is also annoying, there are even repos designed to handle this problem by swapping out the original version with a precompiled for lambda version. But relying on 3rd party repos that haven't been updated in yearsdoesn't seem like a viable solution for me.
I think the solution that might be the least complicated would be to spin up an EC2 box using the same Amazon Linux that Lambda uses, which is currently:
arn:aws:lambda:::awslayer:AmazonLinux1803
Then basically copy over the lambda function file and any local dependencies and then install the other dependencies using pip onto the box, then compile all the dependencies and pull the zip file back down. Then destroy the box. You could even locally cache the dependencies so you wouldn't have to always spin up a new EC2 box every time they deployed (if the dependencies or versions haven't changed).
This solution has a bunch of moving parts but I don't think any of them are that complex or error prone. Biggest issue will be running the remote commands on the EC2 box, I think something like fabric would be overkill, so I would need to look into other solutions.
The problem
Turns out, Python modules with
.so
libraries installed via pip will probably not work when ran on Lambda. This makes sense but it is also annoying, there are even repos designed to handle this problem by swapping out the original version with a precompiled for lambda version. But relying on 3rd party repos that haven't been updated in years doesn't seem like a viable solution for me.I can get into the manylinux wheels but I think this is only a partial solution that works with some packages on not others (more research would be needed), this is something Zappa does when figuring out dependencies.
Proposed Solution
I think the solution that might be the least complicated would be to spin up an EC2 box using the same Amazon Linux that Lambda uses, which is currently:
Then basically copy over the lambda function file and any local dependencies and then install the other dependencies using pip onto the box, then compile all the dependencies and pull the zip file back down. Then destroy the box. You could even locally cache the dependencies so you wouldn't have to always spin up a new EC2 box every time they deployed (if the dependencies or versions haven't changed).
This solution has a bunch of moving parts but I don't think any of them are that complex or error prone. Biggest issue will be running the remote commands on the EC2 box, I think something like fabric would be overkill, so I would need to look into other solutions.
Search
Links
The text was updated successfully, but these errors were encountered: