Giter Club home page Giter Club logo

aws-lambda-with-grpc's Introduction

#CS441: Homework 6 ##Using gRPC & REST requests to invoke AWS Lambda function through AWS API Gateway

##Prerequisites

  • protoc should be installed
  • SBT and Scala should be installed
  • Internet connection required

##Steps to run

  1. Open command line at root of project (i.e. at /chinmay_gangal_hw6)

  2. Run sbt. This launches the sbt command line

  3. Run clean. This erases previous cached output files

  4. Run compile. This would generate the scala files required from proto using protobuf

  5. First we need to start gRPC server, by executing command runMain GRPCServer.

  6. Open another terminal, since the previous would be occupied by the listening server

  7. Redo step 2

    Before we move on to running the gRPC client, we need to understand the format of input parameters for the calculator.

    We have 3 parameters: 2 operands and an operator

    Each operand is a valid number (integer & float) For operator, we have 3 choice: add, sub, mul & div which stand for addition, subtraction, multiplication & division respectively

    The input is provided in the following format: operand1,operand2,operator

    For example, to calculate 5/3, we input 5,3,div

    Observe that the order of the operands is important for subtraction and division

  8. Now we execute client, with command line parameters. Type runMain GRPCClient <input-as-shown-above> command.

  9. The output will contain a line ...Result: <calculation-output>.

This is the result of your input returned from AWS Lambda function, accessed through AWS API Gateway

##Development steps

  • Implementing Lambda & its API
    1. Created Lambda function for calculator using AWS SAM. URL: https://7ub4yveql2.execute-api.us-east-1.amazonaws.com/public/calc
    2. Added API Gateway to Lambda method, then tested online as REST request, and then from Postman
  • Implmenting gRPC in Scala 3. Installed protoc and tested gRPC for Java application using protobuf for Java on .proto file(s) 4. Implemented local gRPC client-server as a Hello World application in Scala using ScalaPB. Client & server are able to exchange basic String messages
  • Integrating and testing 5. Connected this implementation with API from step 2 6. Added test cases, and config file

##Technologies used

  • Scala
  • SBT
  • gRPC
  • ScalaPB: ProtoBuf for Scala

##Author Chinmay Gangal: [email protected]

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.