Try Node.js 15.2.0 on AWS Lambda by using AWS Custom Lambda Runtime

Subscribe to my newsletter and never miss my upcoming articles

AWS Lambda supports multiple languages through the use of runtimes. You choose a runtime when you create a function, and you can change runtimes by updating your function's configuration. The underlying execution environment provides additional libraries and environment variables that you can access from your function code.

As of now, AWS Lambda supports only recent stable Nodejs version.

NameIdentifier
Node.js 12nodejs12.x
Node.js 10nodejs10.x

But if you visit Official Nodejs, you would see 2 new version with new updates and features.

  1. 14.15.0 - Stable LTS Version
  2. 15.2.0 - Current Version

So, I just forked into Epsagon Repo and created new Node.js 15.2.0 Custom Runtime for AWS Lambda and wrapped the runtime in AWS Lambda Layer to test new features.

Steps to Use:

  1. Create new function with option : provide your own bootstrap on Amazon Linux 2

image.png

2 . Create index.js file in the lambda code.

const { exec } = require('child_process');

exports.handler = function (event, context) {
    exec('node -v', (error, stdout, stderr) => {
      if (error) {
        console.error(`exec error: ${error}`);
        return;
      }
      console.log(`stdout: ${stdout}`);
      console.error(`stderr: ${stderr}`);
    });
};

image.png

3 . Attach the give layer or create your own from above Repo.
AWS Layer Version ARN: aws:lambda:us-east-1:741365237744:layer:runtime-nodejs15-2-0:1

4 . To use a handler, use the full path as a handler.
Update handler in lambda configuration as: index.handler from hello.handler

image.png

Run a Test Event

image.png

It could be possible that AWS Team might be optimizing the new version to improve startup time and reduce the billed duration for feasibiliy and cost optimization. Till then, keep testing new features of Node.js.

Repository Link to fork:
https://github.com/arki7n/nodejs15.2.0-aws-lambda-runtime

Please note that this runtime is only for testing and not recommended for production usage.

Follow me on https://twitter.com/arki7n for more updates related to AWS and Javascript.

No Comments Yet