You can deploy your Lambda function code as a container image. AWS provides the following resources to help you build a container image for your Node.js function:
-
AWS base images for Lambda
These base images are preloaded with a language runtime and other components that are required to run the image on Lambda. AWS provides a Dockerfile for each of the base images to help with building your container image.
-
Open-source runtime interface clients
If you use a community or private enterprise base image, add a runtime interface client to the base image to make it compatible with Lambda.
AWS provides the following base images for Node.js:
Tags | Runtime | Operating system | Dockerfile |
---|---|---|---|
12 | NodeJS 12.x | Amazon Linux 2 | Dockerfile for Node.js 12.x on GitHub |
10 | NodeJS 10.x | Amazon Linux 2 | Dockerfile for Node.js 10.x on GitHub |
Docker Hub repository: amazon/aws-lambda-nodejs
Amazon ECR repository: gallery.ecr.aws/lambda/nodejs
Install the runtime interface client for Node.js using the npm package manager:
npm install aws-lambda-ric
For package details, see Lambda RIC on the npm website.
You can also download the Node.js runtime interface client from GitHub.