Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared library packages #2

Open
Jaymon opened this issue Dec 4, 2019 · 0 comments
Open

Shared library packages #2

Jaymon opened this issue Dec 4, 2019 · 0 comments

Comments

@Jaymon
Copy link
Owner

Jaymon commented Dec 4, 2019

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:

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.

Search

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant