Setting up Shapely on AWS Lambda Python functions

旧城冷巷雨未停 提交于 2019-12-02 05:29:07

If you wish to build your own Lambda compatible binaries for use in your Deployment packages, AWS states the AMI needed to build them here:

https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html

I have created an EC2 instance with that specific AMI and then used pip to install the packages I needed into a target folder -t. Once complete I simply tar'd that up and used it as the basis for my deployment package and it worked.

Alternatively I have downloaded from : https://github.com/ryfeus/lambda-packs and copied the packages I have needed. (Which in the case of shapley, was the shapely and shapely-1.6b4.dist-info directories.

I believe these are only built for Python 2.7 at the moment, and I have only compiled binaries with the above AMI for Python 2.7.

HTH

I hit this same issue, and was able to set up to build a layer for use in Lambda. I wrote it up as an open source package here https://github.com/bearflagrobotics/libgeos-lambda-build using Docker to build the binary distribution. You can just drop that in as a layer for your lambda function and run any version of Shapely or Python you want!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!