AWS Lambda Tutorial: How to deploy Node.js REST APIs on aws lambda Function

Поделиться
HTML-код
  • Опубликовано: 11 окт 2024
  • In this video we are going to deploy our Expressjs rest api on aws lambda function using serverless framework
    which is a great combination, super simple to use and extremely powerful
    So if you are not familiar with lambda. so let me tell you its new paradigm that provides function as a service
    So lambda is a cloud computing architecture where the application owner does not purchase, rent, manage, our provision the servers,
    instead aws manages the infrastructure side of the things for the applications.
    The biggest advantages of this architecture is that provisioning of servers is done dynamically to meet the real-time computing demand
    serverless doesn't mean it run without server it means we don't need to manage the server side things so we could only focus on development
    Functions-as-a-Service (FaaS) is a business model that lets you execute a piece of code and only charges you for the resources you use. As a developer, this means that you don't have to think about managing servers and scaling. You just focus on code.
    There are several service providers who provide FaaS, such as Amazon Web Services Lambda, Google Cloud Functions, and Microsoft Azure Functions.
    In this post we will see how to deploy an Express.js application to the AWS Lambda function and we will use the Serverless Framework to automate our deployment process.
    In this video we will:
    Understand Serverless
    Convert the Express app to make it ready to deploy on the Lambda environment
    Set up Serverless Framework and deploy the application to AWS Lambda
    Finally, test our application
    Why use Serverless
    Cost-effective:
    With a serverless architecture, you pay only for what you use. There is no idle capacity, no wasted resources, or money.
    No Server Management:
    Say goodbye to backend infrastructure management. No downtime, no provisioning or maintaining of servers ever again.
    Virtually limitless scalability:
    Scale only functions and not the application. Scaling up or down is as simple as executing a few lines of code.
    High availability:
    Extreme fault tolerance, which is made possible by multiple redundancies, is baked into the serverless architecture.

Комментарии • 53

  • @maysamtayyeb4552
    @maysamtayyeb4552 Год назад +5

    Awesome tutorial mate. Concise and rich. Was wondering if you could share a repo that has all you've explained.

  • @kkvaruas5759
    @kkvaruas5759 2 года назад +11

    for those who are getting internal server error ,pls make sure that you are doing *module.exports = app* im your server.js file

  • @Benjamin-Chavez
    @Benjamin-Chavez 10 месяцев назад

    Are you sure that that’s an express.js server? Helpful tutorial in any case. Thanks!

  • @patshalaaa
    @patshalaaa Месяц назад

    any production grad tutorial on serverless please . including ssl, load balancing , domain connection

  • @eduardocampili6004
    @eduardocampili6004 3 года назад +1

    Great Tutorial, all is working fine, i have problems with custom headers with tokens, do you have any tutorial about this problem? Thank You

  • @nageshswamii3770
    @nageshswamii3770 2 месяца назад

    Thank You , very helpfull video

  • @kurisuta1305
    @kurisuta1305 2 года назад

    Thank you! The tutorial I needed! :) Keep up the good work 😃

  • @nageshswamii3770
    @nageshswamii3770 10 дней назад

    i have create already api gateway and lambda function . i want deploy on this lambda function using api gateway path. what is approach ?

  • @MrRahul15937
    @MrRahul15937 6 месяцев назад

    Thanks friend

  • @udaykumar-cx9lu
    @udaykumar-cx9lu 2 года назад +1

    why did you create node httpServer, it seems you are not using fully
    serverless ?

  • @SoubhikChatterjee-u1w
    @SoubhikChatterjee-u1w Год назад +1

    +1 For putting efforts in making this video
    -1 For no providing the source code.

  • @mahendranath2504
    @mahendranath2504 Год назад

    Thank you so much 👍

  • @akhil_kathi
    @akhil_kathi 2 года назад +1

    I am using express with typescript with ES2017. Then how to go about with Lambda deployment?

  • @devcoder6326
    @devcoder6326 Год назад

    Awesome!

  • @cheung6033
    @cheung6033 3 года назад +2

    The interface to integrate lambda serverless and your rest api server is the handler.js, am I right? Thanks

  • @benjaminakindeko3894
    @benjaminakindeko3894 2 года назад

    Thank you...very helpful

  • @kritarthsinghal3714
    @kritarthsinghal3714 3 года назад +2

    this is responding with {"message": "Internal server error"} while the API sunning perfectly on Local

    • @TechnicalBabaji1
      @TechnicalBabaji1  3 года назад

      This means you made mistakes but as you are claiming that it’s working fine in local then chances are handler.js has some issues or in yml file please check

    • @bhargavsurani6279
      @bhargavsurani6279 3 года назад

      @@TechnicalBabaji1 i am facing same problem.. i show error message in cloudwatch log it showing this message : "Module did not self-register: '/var/task/node_modules/snappy/build/Release/binding.node'."

    • @raprap621
      @raprap621 2 года назад

      Up on this running locally but if access sa link it shows the error

    • @bhavikjain7350
      @bhavikjain7350 2 года назад +2

      I am getting the same error. Did you find solution for this???

  • @rabbyhossain6150
    @rabbyhossain6150 2 года назад

    Is it a good way to run the entire application on a single lambda?

  • @frazbakht4480
    @frazbakht4480 Год назад +1

    It is okayish because it's not a good idea to use only 1 lambda function for all endpoints

  • @patshalaaa
    @patshalaaa Месяц назад

    Is there any production grade video. please give me a link

  • @DeveloperDhiraj
    @DeveloperDhiraj Год назад

    the image after uploading by lambda api is showing not supported format before i wast uploading with localhost api it was working any suggestion ?

  • @suryak8286
    @suryak8286 Год назад

    Either "handler" or "image" property needs to be set on function "events". i am getting error

  • @sankarprakash7472
    @sankarprakash7472 Год назад

    I build one mern stack app and deployed it in aws lambda, but when I try to access got internal error. Then came to know that there parsing error with mongodb url added in serverless yaml file. It's having special character like @ : , so it's parsing error. How to handle this? I tried by passing key followed by pipe symbol also it's not working.
    undefined INFO Error: MongoParseError: Incomplete key value pair for option

  • @sankarprakash7472
    @sankarprakash7472 Год назад

    I have mongo dB uri added as a variable in server less yaml file but after deployed I accessed the url it's showing error like parsing error. How to handle this issue
    Error: undefined INFO Error: MongoParseError: Incomplete key value pair for option

  • @mirzaali9901
    @mirzaali9901 2 года назад +1

    I am facing this error while creating serverless create -t aws-nodejs Error:
    Could not download template. Ensure that you are using the latest version of Serverless Framework: Timeout awaiting 'request' for 30000ms
    Please help me to sort this out

    • @MrRahul15937
      @MrRahul15937 6 месяцев назад

      Sounds like network issue

  • @anubhavshrivastav8270
    @anubhavshrivastav8270 2 года назад

    creating a external api call in node js lambda and could not find a way to deploying it

  • @saankhyakatari6652
    @saankhyakatari6652 Год назад

    There's a error when followed the above steps. The error is "Cannot parse "serverless.yml": bad indentation of a mapping entry" . I also tried finding that error in google as well but couldn't find the solution . Can you help ?

    • @saankhyakatari6652
      @saankhyakatari6652 Год назад +1

      check the space between the margin and the text in serverless.yml file. The error line is shown in the terminal.

  • @mystikyogi
    @mystikyogi 11 месяцев назад

    API response is slow, its taking more than 2.5s to get result with lambda

  • @coderzone123
    @coderzone123 Год назад

    I am getting internal server error

  • @HOLONIA4EVER
    @HOLONIA4EVER Год назад

    Thanks !
    Can you attach the source code please ?

  • @rajatsharma6137
    @rajatsharma6137 2 года назад

    please show how to do it from scratch...just a basic crud application...this is little confusing..

  • @mohit-codewave
    @mohit-codewave Год назад

    can we change node 14 to 18

  • @ivangarcialaverde2065
    @ivangarcialaverde2065 Год назад

    should'nt you hide the aws key and secret for security ?👁👄👁

  • @006sumitkumar8
    @006sumitkumar8 Год назад

    can you send the code

  • @holanube5195
    @holanube5195 3 года назад

    please share the code. Thanks!

  • @Nitin.0202
    @Nitin.0202 Год назад

    if you do already why you create this video ? 😒😒😒😒

  • @sunilsuryawanshi6110
    @sunilsuryawanshi6110 2 года назад +1

    I followed the entire video and got the following error after deploying on AWS and trying to run the API; any idea what must be causing this?
    "Error: Unsupported framework",
    " at getFramework (/var/task/node_modules/serverless-http/lib/framework/get-framework.js:69:9)"

  • @SrivishnuCS-b1n
    @SrivishnuCS-b1n 8 месяцев назад

    i am trying to deploy but its throwing
    Cannot read file node_modules\core-js-pure\modules\esnext.promise.with-resolvers
    .js due to: EMFILE: too many open files, open 'D:\serverless-kangaroo-care
    ode_
    modules\core-js-pure\modules\esnext.promise.with-resolvers.js'
    1 deprecation found: run 'serverless doctor' for more details
    × Uncaught exception
    D:\serverless-kangaroo-care
    ode_modules\serverless\scripts\serverless.js:52
    throw error;
    ^
    [Error: EMFILE: too many open files, open 'C:\Users\srivi\AppData\Local\Temp
    od
    e-process-b9bf\health-status'] {
    errno: -4066,
    code: 'EMFILE',
    syscall: 'open',
    path: 'C:\\Users\\srivi\\AppData\\Local\\Temp\
    ode-process-b9bf\\hea

    • @shaikhareebali3217
      @shaikhareebali3217 8 месяцев назад

      there may be llimitation in editor while opening multiple files while deploying try with just opening server.js file