🌐
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › building lambda functions with node.js
Building Lambda functions with Node.js - AWS Lambda
For example, to enable ES module require support, set NODE_OPTIONS to --experimental-require-module. Lambda detects this override and removes the corresponding disable flag. Using experimental features can lead to instability and performance issues. These features might be changed or removed ...
🌐
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › building lambda functions with node.js › define lambda function handler in node.js
Define Lambda function handler in Node.js - AWS Lambda
You can configure Node.js in Lambda to detect automatically whether a .js file should be treated as CommonJS or as an ES module by adding the —experimental-detect-module flag to the NODE_OPTIONS environment variable. For more information, see Experimental Node.js features. The following examples show function handlers written using both ES modules and CommonJS modules. The remaining examples on this page all use ES modules. ... const url = "https://aws.amazon.com/"; export const handler = async(event) => { try { const res = await fetch(url); console.info("status", res.status); return res.status; } catch (e) { console.error(e); return 500; } };
Discussions

Invoke amazon lambda function from node app
In this example we are creating an image re-sizing service, one way to trigger it is to listen for some image to be pushed to a S3 bucket and then lambda function will be executed. But I am trying to understand how to invoke this lambda function from my nodejs app, when user send an image to my node server, I send this image to aws ... More on stackoverflow.com
🌐 stackoverflow.com
Deploying a node js project on aws lambda?
Lambdas can only run for 15 minutes so using that as your frontend would be counter intuitive. I suggest looking into using S3 to serve your static frontend and use a serverles lambda function as your backend. See: https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/deploy-a-react-based-single-page-application-to-amazon-s3-and-cloudfront.html More on reddit.com
🌐 r/aws
8
0
January 24, 2023
You are Senior JS Backend at start up. What do you choose Bun vs Node.js?
Node.js, in my experience it's more mature than bun More on reddit.com
🌐 r/webdev
58
0
March 4, 2026
How I got Typescript Lambda Layers working with SAM template.
This is how I'm doing it: https://dan.salvagni.io/b/aws-sam-and-typescript-building-functions-and-layers/ I also have my layers as dev dependencies in a global package.json so vscode can pick them up while writing code: "devDependencies": { "commons": "file:./layers/commons", ... } More on reddit.com
🌐 r/aws
11
19
April 27, 2023
🌐
Medium
medium.com › hackernoon › getting-started-with-aws-lambda-and-node-js-4ce3259c6dfd
Getting Started with AWS Lambda and Node.js | by Adnan Rahić | HackerNoon.com | Medium
August 16, 2018 - You’ll land on the Lambda homepage with a big orange button prompting you to create a new function. Well, don’t keep it waiting any longer, press it. ... This will take you to the main function creation wizard. As this example will cover a basic function that will simulate a dice throw, let’s forget about the blueprints and just author one from scratch. Awesome!
🌐
RisingStack
blog.risingstack.com › home › hírek, események › getting started with aws lambda & node.js
Getting Started with AWS Lambda & Node.js - RisingStack Engineering
May 29, 2024 - Getting started with Serverless on AWS Lambda is just a few commands away: # 1. Create a new Serverless project: $ serverless create --template aws-nodejs --path my-service # 2. Change into the newly created directory $ cd my-service # 3. Install ...
🌐
AWS
aws.amazon.com › blogs › compute › node-js-20-x-runtime-now-available-in-aws-lambda
Node.js 20.x runtime now available in AWS Lambda | Amazon Web Services
November 15, 2023 - You can now develop AWS Lambda functions using the Node.js 20 runtime. This Node.js version is in active LTS status and ready for general use. To use this new version, specify a runtime parameter value of nodejs20.x when creating or updating functions or by using the appropriate container base ...
🌐
Medium
medium.com › @tombray › getting-started-with-aws-lambda-node-js-904bc0bfb83
Getting Started with AWS Lambda (Node JS) | by Tom Bray | Medium
January 10, 2016 - Getting Started with AWS Lambda (Node JS) In this article I’ll walk you through creating a Lambda the easy way, using the AWS Console. At the end I provide links to gulp projects that will help you …
Find elsewhere
🌐
Lumigo
lumigo.io › guides › aws lambda 101 › aws lambda nodejs: building functions
AWS Lambda NodeJS: Building Functions - Lumigo
November 30, 2022 - AWS Lambda functions in NodeJS are essentially the same as any other NodeJS application. There’s an entry function that handles an event, and source code written in JavaScript that processes the event to produce a result. Lambda functions, when invoked, call a handler function that shares the same prototype for every Lambda trigger.
🌐
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › lambda sample applications
Lambda sample applications - AWS Lambda
– An example that shows how to use Quarkus in a managed Java runtime with and without SnapStart, or as a GraalVM native image with a custom runtime. Learn more in the Quarkus/Lambda guide ... – A hello world function that returns the public IP address. This app uses the provided.al2 custom runtime. ... – A Go function that shows the use of Lambda's Go libraries, logging, environment variables, and the AWS SDK.
🌐
SST
sst.dev
SST
Blog Docs Examples · 25K · AI · Search CtrlK · Cancel · Console · sst.config.ts · const db = new planetscale.Database("Db") const email = new sst.aws.Email("Email", { sender: "mail@example.com" }) const api = new sst.aws.Service("Api", { memory: "4 GB", image: "./rails", link: [db, email] }) const web = new sst.aws.Nextjs("Web", { link: [api], path: "./nextjs", domain: "example.com", dns: sst.cloudflare.dns() }) Deploy everything your app needs with a single config.
🌐
GitHub
github.com › aws-samples › aws-lambda-demo-with-node-express
GitHub - aws-samples/aws-lambda-demo-with-node-express · GitHub
The purpose of this repository is to demonstrate how to deploy a simple web application built by Express - Node.js web application framework on AWS Lambda.
Starred by 21 users
Forked by 20 users
Languages   JavaScript 52.7% | HTML 47.3%
🌐
Pegasus One
pegasusone.com › home › how to use aws lambda function in node.js
How to Use AWS Lambda Function in Node.js - Pegasus One
February 6, 2026 - How do you use an AWS Lambda function in Node.js? You use an AWS Lambda function in Node.js by writing your function handler in JavaScript or TypeScript, wp_title()
🌐
Trigger.dev
trigger.dev
Trigger.dev | Build and deploy fully-managed AI agents and workflows.
The first time I used Trigger.dev, I had an a-ha moment, I no longer needed to set up everything with ECS or Lambda. What also stands out is the exceptional support, unlike any I've seen in the web community. ... P.S. Bridal · The reliability of Trigger.dev's job scheduling has been essential as we've scaled our evidence collection automation and built our open source community of 600+ compliance professionals. ... We migrated from an AWS background job service that required a dedicated expert for maintenance.
🌐
Medium
umarfarooquekhan.medium.com › aws-lambda-with-node-js-ecbda96805c5
AWS Lambda with Node.js. Exploring AWS Lambda with Node.js | by Umar Farooque Khan | Medium
November 10, 2023 - Create a Lambda Function: Log in to the AWS Management Console, navigate to Lambda, and click “Create Function.” You can choose between various options, including “Author from scratch” and “Use a blueprint.” For this example, we’ll author a function from scratch.
Top answer
1 of 4
69

Since you are using a node.js server you can just invoke your lambda directly with the AWS JavaScript SDK(https://www.npmjs.com/package/aws-sdk). This way you don't have to worry about using API Gateway.

Invoking from your server is as simple as:

var AWS = require('aws-sdk');

// you shouldn't hardcode your keys in production! See http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html
AWS.config.update({accessKeyId: 'akid', secretAccessKey: 'secret'});

var lambda = new AWS.Lambda();
var params = {
  FunctionName: 'myImageProcessingLambdaFn', /* required */
  Payload: PAYLOAD_AS_A_STRING
};
lambda.invoke(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

See the rest of the SDK docs here: http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Lambda.html

2 of 4
41

Here is an answer that is more idomatic for the latest JavaScript.

import AWS from 'aws-sdk';

const invokeLambda = (lambda, params) => new Promise((resolve, reject) => {
  lambda.invoke(params, (error, data) => {
    if (error) {
      reject(error);
    } else {
      resolve(data);
    }
  });
});

const main = async () => {

  // You shouldn't hard-code your keys in production! 
  // http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html
  AWS.config.update({ 
    accessKeyId: 'AWSAccessKeyId', 
    secretAccessKey: 'AWSAccessKeySecret', 
    region: 'eu-west-1',
  });

  const lambda = new AWS.Lambda();

  const params = {
    FunctionName: 'my-lambda-function', 
    Payload: JSON.stringify({
      'x': 1, 
      'y': 2,
      'z': 3,
    }),
  };

  const result = await invokeLambda(lambda, params);

  console.log('Success!');
  console.log(result);
};

main().catch(error => console.error(error));

Update

Rejoice! The AWS SDK now supports promises:

import AWS from 'aws-sdk';

const main = async () => {

  // You shouldn't hard-code your keys in production! 
  // http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html
  AWS.config.update({ 
    accessKeyId: 'AWSAccessKeyId', 
    secretAccessKey: 'AWSAccessKeySecret', 
    region: 'eu-west-1',
  });

  const params = {
    FunctionName: 'my-lambda-function', 
    Payload: JSON.stringify({
      'x': 1, 
      'y': 2,
      'z': 3,
    }),
  };

  const result = await (new AWS.Lambda().invoke(params).promise());

  console.log('Success!');
  console.log(result);
};

main().catch(error => console.error(error));
🌐
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › building lambda functions with node.js › instrumenting node.js code in aws lambda
Instrumenting Node.js code in AWS Lambda - AWS Lambda
To avoid uploading runtime dependencies every time you update your function code, package the X-Ray SDK in a Lambda layer. The following example shows an AWS::Serverless::LayerVersion resource that stores the AWS X-Ray SDK for Node.js. Resources: function: Type: AWS::Serverless::Function Properties: CodeUri: function/. Tracing: Active Layers: - !Ref libs ... libs: Type: AWS::Serverless::LayerVersion Properties: LayerName: blank-nodejs-lib Description: Dependencies for the blank sample app.
🌐
AWS re:Post
repost.aws › knowledge-center › lambda-layer-aws-sdk-latest-version
Integrate the AWS SDK for JavaScript into a Node.js Lambda function | AWS re:Post
April 28, 2025 - docker run --entrypoint "" -v "$PWD":/var/task "public.ecr.aws/lambda/nodejs:<version>" /bin/sh -c "npm install aws-sdk; exit"
🌐
Medium
medium.com › intrinsic-blog › basic-node-js-lambda-function-concepts-c0d1e00d4528
Basic Node.js Lambda Function Concepts | by Thomas Hunter II | intrinsic | Medium
May 29, 2018 - In this three-part-series we’ll look at getting a Node.js application which performs image resizing running on AWS Lambda. We’ll look at how Node.js applications work, then we’ll configure our AWS account and get the AWS CLI utility working. We’ll Create a Lambda Function within AWS and configure an Application Gateway which is required to route HTTP requests to our Lambda Function.