Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tsmx/nodejs-lambda-tutorial
Tutorial for creating and deploying a Lambda function on AWS with Node.js (ESM)
https://github.com/tsmx/nodejs-lambda-tutorial
aws aws-cli aws-lambda aws-lambda-node docker esm esmodules lambda-functions lamdba nodejs
Last synced: about 2 months ago
JSON representation
Tutorial for creating and deploying a Lambda function on AWS with Node.js (ESM)
- Host: GitHub
- URL: https://github.com/tsmx/nodejs-lambda-tutorial
- Owner: tsmx
- Created: 2023-08-03T20:47:54.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-07-26T19:20:03.000Z (5 months ago)
- Last Synced: 2024-07-26T20:59:48.619Z (5 months ago)
- Topics: aws, aws-cli, aws-lambda, aws-lambda-node, docker, esm, esmodules, lambda-functions, lamdba, nodejs
- Language: JavaScript
- Homepage:
- Size: 80.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Creating an AWS Lambda function with Node.js
> Tutorial for creating an AWS [Lambda](https://aws.amazon.com/de/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](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
- Docker, v20.10 was used here## The Lambda function
The function itself is defined in `index.js` and called [handler](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-handler.html) in the AWS Lambda terminology..
```js
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](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-context.html).
**More information coming soon...**