Deploying NodeJS Application On AWS Lambda
Posted By : Vishal Yadav | 09-Apr-2020
AWS Lambda is a serverless computing service that is used to run code on events and manages the computing tasks required by the code. Lambda is a Function as a Service that is used to build the serverless application that is triggered by events. An application can be deployed on Lambda by creating zip and upload directly to s3 or by setting the serverless framework which can be used to directly upload from the system. In this blog, we are using the serverless framework to deploy on AWS Lambda.
Pricing is a crucial factor in AWS development services. AWS Lambda costs $0.20 per 1Million requests and $0.0000166667 for every GB-second which is much less than the standard Amazon EC2 pricing and you don't have to pay for the idle time.
- AWS IAM account with access to lambda
1. Install the Serverless Framework and configure it.
2. Install serverless-http in the working directory and update app.js/server.js code.
3. Create handler.js and serverless.yml in the root folder of the working directory.
4. Deploy code on AWS lambda.
The above code mention how NodeJS/Express application can be deployed on AWS Lambda using a serverless framework. By using the serverless framework you don't create zip and upload on s3 for each change only one command is required to deploy on AWS Lambda/s3.