-
Notifications
You must be signed in to change notification settings - Fork 0
Lambda Functions
This document provides an overview of the Lambda functions used within the project, detailing the structure and deployment process of these functions. If you're new to AWS Lambda, it's a serverless compute service that lets you run code without provisioning or managing servers, automatically scaling your application by running code in response to events.
The project's Lambda functions are located within the /lambda directory. Each subdirectory under /lambda is dedicated to a specific Lambda function. The structure for each is as follows:
-
index.mjs: The entry point for the Lambda function. AWS Lambda executes this file in response to events. -
package.json: Manages the dependencies of the Lambda function. Each function has its ownpackage.jsonfile, allowing for independent management of dependencies.
This structure is critical because AWS Lambda requires the entire function, including its dependencies, to be uploaded as a zip file. Therefore, each function in the /lambda directory is a standalone package that can be independently developed, tested, and deployed.
AWS Lambda functions are designed to run code in response to triggers such as changes in data, shifts in system state, or actions by users. Lambda can automatically manage the compute resources for you, making it easy to scale your application while only paying for the compute time you consume.
When a Lambda function is invoked, AWS Lambda launches an instance of the function and runs the code by executing the index.mjs file. If the function needs to be executed again and the previous instance is still available, AWS Lambda can reuse it to improve performance. If the function is invoked simultaneously by multiple events, AWS Lambda scales horizontally by running multiple instances of the function.
Deploying a Lambda function involves zipping the function's directory, including the index.mjs file and any dependencies specified in package.json, and then uploading it to AWS Lambda. This can be done through the AWS Management Console, AWS CLI, or through CI/CD pipelines for automated deployments.
The Lambda functions in this project are integrated with other components such as the Vue.js frontend and are triggered by specific events or API requests. For details on how these functions interact with other parts of the project, refer to the [Project Structure] page.