You can run jsreport also as serverless in AWS Lambda. This is the very convenient way how to run cheap and automatically scalable reports rendering without a need for paying for the actual servers. This documentation helps you with creating the AWS Lambda running jsreport, deploying templates and remote invocation of the rendering.
We prepared starter github repository jsreport-aws-lambda-starter-kit for you. The first you need to clone it.
git clone https://github.com/jsreport/jsreport-aws-lambda-starter-kit.git
Install dependencies and start jsreport...
npm i npm start
On Linux, make sure you have the required chrome shared libraries mentioned in the install docs.
http://localhost:5488 and prepare jsreport templates the same way you would do when running normal jsreport.
The best way is to create lambda layer with node_modules folder and then have just templates and configs inside the lambda function package itself. There is
createLambdaLayer.js script that helps you with that.
Call it using
Then log in to aws console and upload the preared
layer.zip to a s3 bucket.
Then create aws lambda layer referencing the uploaded zip with nodejs 12.x runtime.
The next step is preparing the lambda package. This can be done using the following script.
Then create lambda function with the prepared
lambda.zip and merging the previously created layer.
We recommend also increasing the memory and timeout to reflect your needs.
It is up to you how you want to integrate the lambda function. It expects the standard jsreport rendering request as the parameter and outputs base64 encoded report output. You can invoke it using many approaches AWS supports like AWS CLI or a specific language SDK. However, we prepared script which uses AWS node.js SDK to invoke the lambda function and you can use it for testing.
report.pdfwas properly rendered