The AWS Lambda PDF Generator is deployed as a fully serverless stack using the Serverless framework. RunningDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/barchart/aws-lambda-pdf-generator/llms.txt
Use this file to discover all available pages before exploring further.
yarn deploy:prod from the project root orchestrates the entire process: it first builds a packaged Chromium Lambda Layer locally via make, then provisions all AWS resources — API Gateway, Lambda functions, IAM roles, CloudWatch log groups, and the Chromium layer — in a single CloudFormation changeset. No manual console steps are required.
Prerequisites
Before deploying, ensure the following tools are installed and configured:- AWS account with the AWS CLI configured (
aws configure) - Node.js 20.x — the Node Version Manager (nvm) is recommended for managing Node versions
- Yarn package manager
- Serverless framework v3.38+ (
npm install -g serverless)
What Gets Deployed
A singleyarn deploy:prod command deploys the serverless-pdf-generator service and creates the following AWS resources in your account:
| Resource | Details |
|---|---|
| API Gateway | HTTP REST endpoint that routes incoming requests to Lambda |
Lambda function — print | Converts HTML to PDF using Puppeteer and Chromium; 2048 MB memory, 30-second timeout |
Lambda function — serviceRead | Returns service metadata (version); lightweight, no Chromium layer |
Lambda Layer — HeadlessChromium | Contains Chromium v122 compatible with nodejs20.x; built locally before deploy |
| IAM Role | Grants the Lambda functions s3:GetObject and s3:PutObject access to the large-response S3 bucket |
| CloudWatch Log Groups | One per Lambda function; logs are retained for 90 days |
Deployment Steps
Install dependencies
Install all workspace dependencies from the monorepo root. Yarn workspaces will link the
packages/api package automatically:Deploy to AWS
Run the appropriate deploy script for your target stage.Production:Staging:Before the Serverless CLI is invoked, the
predeploy script automatically runs make clean && make all inside packages/api. This clones the @sparticuz/chromium repository at the v122.0.0 tag, compiles it, and produces the layer artifact at packages/api/layers/chromium-v122.zip. The Serverless framework then uploads this artifact as the HeadlessChromium Lambda Layer.Stages
The project supports two named deployment stages. Each stage is an independent CloudFormation stack and creates separate AWS resources:| Stage | Deploy command | Use case |
|---|---|---|
stage | yarn deploy:stage | Integration testing, QA validation |
prod | yarn deploy:prod | Live production traffic |
NODE_ENV environment variable, allowing the application code to branch on environment at runtime.
Your AWS IAM user or role must have sufficient permissions to deploy this stack. At a minimum, the following service permissions are required: Lambda, API Gateway, IAM (role and policy management), S3 (deployment bucket access), CloudFormation, and CloudWatch Logs.