Skip to content

Tutorial for creating and deploying a Lambda function on AWS with Node.js (ESM)

Notifications You must be signed in to change notification settings

tsmx/nodejs-lambda-tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Creating an AWS Lambda function with Node.js

Tutorial for creating an AWS Lambda function in Node.js (ESM) and deploying it with pure code upload or a Docker-image using the AWS CLI.

Prerequisites

To follow along the tutorial you'll need up & running...

  • Node.js >= v14, version 18 LTS or higher recommended
  • AWS CLI v2, see the getting started guide
  • Docker, v20.10 was used here

The Lambda function

The function itself is defined in index.js and called handler in the AWS Lambda terminology..

export const handler = async (event, context) => {
  console.log('EVENT: \n' + JSON.stringify(event, null, 2));
  return { info: 'Hello from AWS Lambda!' };
};

As per definition, any Lambda function will receive an event which is a JSON object passed by the invoker and a context object passed by Lambda itself. See here for details about the context.

More information coming soon...

Releases

No releases published

Packages

No packages published