How to use LibPostal on AWS Lambda
Hi!
I was checking out libpostal, and wanted some additional information on deploying it to AWS Lambda.
Here's what I have done so far
I was able to build and install it in my local Ubuntu machine without any issues and consume it in my program. But now, I need to deploy it on Lambda. However, I am not able to find the steps for doing it
Could any please help me?
Regards, Sai Vijay H
I would be interested in knowing that too
related: https://github.com/openvenues/libpostal/issues/512
The main two issues you'll encounter are:
- Memory requirement ~2GB+ (I would start at 3GB and work down)
- Deployment package (.zip file archive) size 50 MB (zipped, for direct upload) 250 MB (unzipped)
As the models take more than 250MB you'll need to use EFS, which adds a bunch of complexity.
https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html
I would suggest generating a custom runtime which has all the C libs and dependencies and then put the libpostal binaries in the deployment package and the models in EFS.
The permissions for using EFS from lambda are a bit fiddly, I've had success in the past using the serverless framework to set that up.
related comment: https://github.com/openvenues/libpostal/issues/368#issuecomment-935192038