Home

Awesome

TeX Live (LaTeX/pdflatex) for AWS Lambda

TeX Live (including latex and pdflatex) for AWS Lambda, including packages and fonts required for Pandoc.

Intended for instances powered by Amazon Linux 2.x, such as the nodejs10.x runtime, and the updated 2018.03 Amazon Linux 1 runtimes

This layer requires Perl

TeX Live requires a functioning perl executable, even at runtime, and this layer does not include that. You can add Perl to the same Lambda function using a third-party layer, for example https://github.com/moznion/aws-lambda-perl5-layer.

Usage

After deployment, the binaries will be in /opt/texlive/bin/x86_64-linux after linking the layer to a Lambda function.

Binaries depend on each other, so when executing, you will need to add that directory to your PATH environment variable.

Prerequisites

Compiling the code

There are two make scripts in this project.

The output will be in the result dir.

Configuring the build

By default, this compiles a version expecting to run as a Lambda layer from /opt/texlive. Change the expected runtime location in texlive.profile.

The default Docker image used is lambci/lambda-base-2:build. To use a different base, provide a DOCKER_IMAGE variable when invoking make.

You can include/exclude collections from texlive.profile, or change the CTAN packages installed in addition to the minimal collection in Makefile_Latex.

Note that this distribution comes with minimal fonts (lm, amsfonts and ec) required for Pandoc. To add the full recommended font set, enable collection-fontsrecommended in texlive.profile.

Experimenting

Compiled info

pdfTeX 3.14159265-2.6-1.40.20 (TeX Live 2019)
kpathsea version 6.3.1
Compiled with libpng 1.6.36; using libpng 1.6.36
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.01

Deploying to AWS as a layer

Run the following command to deploy the compiled result as a layer in your AWS account.

make deploy DEPLOYMENT_BUCKET=<YOUR BUCKET NAME>

configuring the deployment

By default, this uses latex-layer as the stack name. Provide a STACK_NAME variable when calling make deploy to use an alternative name.

example usage

An example project is in the example directory. It sets up two buckets, and listens to file uploads on the first bucket to convert and generate HTML files from markdown. You can deploy it from the root Makefile using:

make deploy-example DEPLOYMENT_BUCKET=<YOUR BUCKET NAME>

For more information, check out:

Author

Gojko Adzic https://gojko.net

License