Skip to content

Convert any document to PDF with headless Libreoffice compiled to run on AWS Lambda

Notifications You must be signed in to change notification settings

ixolt/serverless-libreoffice

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serverless LibreOffice

👉🏻 Read the blog post on Medium: How to Run LibreOffice in AWS Lambda for Dirty-Cheap PDFs at Scale 👈🏻

Show Me the Code

This repo contains code used to run the online demo.

├── compile.sh  <-- commands used to compile LibreOffice for Lambda
├── infra       <-- terraform config to deploy example Lambda
│   ├── iam.tf
│   ├── lambda.tf
│   ├── main.tf
│   ├── s3.tf
│   └── vars.tf
└── src         <-- example Lambda function node in Node.js used for website demo
    ├── handler.js
    ├── libreoffice.js
    ├── logic.js
    ├── package.json <-- put lo.tar.gz in this folder to deploy. Download it below
    └── s3.js

Compiled and ready to use archive can be downloaded under Releases section.

How To Help

Reduce Cold Start Time

Currently ƛ unpacks 109 MB .tar.gz to /tmp folder which takes ~1-2 seconds on cold start.

Would be nice to create a single compressed executable to save unpack time and increase portability. I tried using Ermine packager and it works!! But unfortunately this is commercial software. Similar open-source analogue Statifier produces broken binaries.

Maybe someone has another idea how to create a single executable from a folder full of shared objects.

Further Size Reduction

I am not a Linux or C++ expert, so for sure I missed some easy "hacks" to reduce size of compiled LibreOffice.

Mostly I just excluded from compilation as much unrelated stuff as possible. And stripped symbols from shared objects.

Here is the list of: available RPM packages and libraries available in AWS Lambda Environment, which can be helpful.

Similar Projects

License

MIT © Vlad Holubiev

About

Convert any document to PDF with headless Libreoffice compiled to run on AWS Lambda

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 36.9%
  • HCL 34.9%
  • Shell 28.2%