Coder Social home page Coder Social logo

aws-lambda-demo-with-node-express's Introduction

How to Deploy a Node-Express App on AWS Lambda

The purpose of this repository is to demonstrate how to deploy a simple web application built by Express - Node.js web application framework on AWS Lambda.

Requirements

  • Node.js with Node Package Manager(npm) should be installed on your local system.

Architecture

Request Response Cycle :

aws-lambda-demo-with-node-express

Prepare the code

  • Download the sample_code directory to your local system.

  • Run npm install command in the same directory of the downladed folder. package.json file includes necessary dependencies to generate node_modules/

  • Create a zip file that will include all files in the directory.

Note: Don't zip the folder itself, but select all files individually. Refer to below image if needed:

example_zip

Create a Lambda function

  • Give your function a name like "aws-lambda-demo-with-node-express". Basic permissions will be sufficient for the purpose of this demonstration

  • Upload zip file created on previous step through the console and click DEPLOY

  • Rename your handler as "lambda.handler". It is the main module that uses aws-serverless-express package to easily get the event object Lambda receives from API Gateway

Integration with API Gateway

  • Create a new REST API and name it "aws-lambda-demo-with-node-express"

  • Create a method with ANY, use Lambda Proxy integration and select your function. Refer to below image if needed:

example_apigw_method

  • Create a resource, configure as proxy resource. Refer to below image if needed:

example_apigw_resource

  • Use Lambda Function Proxy and select your function.

  • Deploy your API and name the stage "calculator".

Note: This will be URL extension for our API, which needs to match with the html form inside our code.

<form class="" action="/calculator" method="post">

  • Now you can [Invoke URL] provided by Amazon API Gateway. You can find this on Stages column of the console.

invoke-url

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

aws-lambda-demo-with-node-express's People

Contributors

amazon-auto avatar burak-aws avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.