libpostal icon indicating copy to clipboard operation
libpostal copied to clipboard

How to use LibPostal on AWS Lambda

Open hsvvijay opened this issue 4 years ago • 6 comments

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

hsvvijay avatar Mar 04 '21 12:03 hsvvijay

I would be interested in knowing that too

michal-ko avatar Sep 30 '21 14:09 michal-ko

related: https://github.com/openvenues/libpostal/issues/512

missinglink avatar Sep 30 '21 17:09 missinglink

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

missinglink avatar Sep 30 '21 18:09 missinglink

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.

missinglink avatar Sep 30 '21 18:09 missinglink

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.

missinglink avatar Sep 30 '21 18:09 missinglink

related comment: https://github.com/openvenues/libpostal/issues/368#issuecomment-935192038

missinglink avatar Oct 06 '21 12:10 missinglink