Skip to content

Run every Node.js version in AWS Lambda

License

Notifications You must be signed in to change notification settings

fusebit/everynode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NOTE: The project has been discontinued. The underlying AWS Lambda layer storage will no longer be accessible after 1/15/2023.

Fusebit

Run Any Node.js Version in AWS Lambda

Everynode allows you to run any version of Node.js in AWS Lambda, in any commercial AWS region. We add support for new Node.js versions within six hours of the release.

Run Any Node.js Version in AWS Lambda

  • Create and run AWS Lambda functions using any version of Node.js >= 11.
  • New releases of Node.js are supported within 6 hours.
  • Deploy to any commercial AWS region.
  • No magic or tricks - open source.
  • Free forever, created and maintained for developers like you by developers at Fusebit.

Quickstart

Let's deploy a Hello, World Lambda function using Node.js 17.5.0 to us-west-1.

First, create the Lambda deployment package:

cat > function.js <<EOF
exports.handler = (event, context, callback) => {
  callback(null, { message: "Hello from Node " + process.version });
};
EOF

zip function.zip function.js

Next, create the hello17 Lambda function in us-west-1 that uses a custom Lambda runtime with Node.js v17.5.0 provided by Fusebit:

# Get the ARN of the custom runtime layer containg Node.js 17.5.0 for us-west-1
LAYER=$(curl https://cdn.fusebit.io/everynode/layers.txt --no-progress-meter | grep 'us-west-1 17.5.0' | awk '{ print $3 }')

# Create a Lambda function using Node.js 17.5.0
aws lambda create-function --function-name hello17 \
  --layers $LAYER \
  --region us-west-1 \
  --zip-file fileb://function.zip \
  --handler function.handler \
  --runtime provided \
  --role {iam-role-arn}

Last, call the function:

aws lambda invoke --function-name hello17 response.json
cat response.json

And voila, welcome to Node.js v17.5.0 in AWS Lambda:

{ "message": "Hello from Node v17.5.0" }

Any Region, Any Node.js Version, One Lambda

The Everynode project provides pre-built AWS Lambda layers that contain custom AWS Lambda runtimes for every Node.js version >=11 in all commercial AWS regions. When you want to create a Lambda function using a specific Node.js version in a specific AWS region, you need to choose the right AWS layer for it.

Each combination of AWS region and Node.js version has a distinct layer ARN you need to use when deploying a Lambda function to that region. You can find the ARN of the layer you need from the catalog we publish:

Lambda layers for new Node.js versions are published generally within 6 hours after the Node.js release.

The JSON format of the catalog is convenient for programmatic use from your application. The text format is convenient for scripting. For example, you can get the AWS Lambda layer ARN for Node.js v17.4.0 in region us-east-1 with:

LAYER=$(curl https://cdn.fusebit.io/everynode/layers.txt --no-progress-meter | grep 'us-east-1 17.4.0' | awk '{ print $3 }')
echo $LAYER

Once you have the ARN of the layer matching your desired Node.js version and AWS region, you can provide it to the --layers option of the aws lambda create-function call, or specify it in the Layers array when making a direct API request.

FAQ

Is it really free?

Yes. Support for any version of Node.js in AWS Lambda is a by-product of the engineering behind Fusebit, our developer-friendly integration platform that helps devs add integrations to their apps.

How can I get in touch with feedback, questions, etc?

You can join our community Slack, Discord, or e-mail us. You can also reach us on Twitter @fusebitio. You can also file an issue in this repo.

How do I report an issue?

File an issue. Or better still, submit a PR.

What's included in the custom runtime?

Only the full release of Node.js (including node, npm, and npx). In particular, the aws-sdk module is not included. If you need to use it, you must include it in your Lambda deployment package.

Is ES6 supported?

Yes, Lambda handlers can be implemented as ES6 modules in Node.js >= 14.

Are you mining bitcoins in my AWS account?

We try not to. But since Everynode is OSS, you can check yourself. You can even deploy your own copies of the custom Lambda layers to your own AWS account.

Do you have cool stickers?

Yes. Get in touch and we will send you some.

About

Run every Node.js version in AWS Lambda

Resources

License

Stars

Watchers

Forks

Packages

No packages published