GithubHelp home page GithubHelp logo

elder-mixer's Introduction

elder-mixer

AWS lambda to gRPC demonstration

Python lambda invokes gRPC server on EC2 instance.

  1. Lambda and gRPC server must route (i.e. same VPC, etc)
    1. Security group must allow gRPC (in this case port 50053)
  2. LambdaBasicExecution (i.e. CloudWatch logs) is enough after installation.
  3. Developed on AWS EC2 (ubuntu server 20.04 LTS)
    1. python 3.8 runtime

Repository tour

  1. proto (directory)
    1. gRPC protobuf definitions
    2. Invoke "proto.sh" to regenerate
  2. server (directory)
    1. gRPC server, "go build" to create
    2. Invoke "run.sh" to run (use a dedicated terminal for the server)
  3. go-client (directory)
    1. gRPC client in go, configured for localhost
    2. Invoke "go run" for diagnostic (with server from previous step)
  4. py-client (directory)
    1. gRPC client in python, configured for localhost
    2. Uses virtualenv
    3. Invoke "proto.sh" to generate gRPC stubs
    4. Invoke "python client.py" to run
  5. py-lambda (directory)
    1. gRPC client as a AWS python lambda
    2. Uses virtualenv
    3. Invoke "lambda-build.sh" to create deployment zip
      1. Two zip files: grpc-layer.zip and elder-mixer.zip
      2. Deploys from s3 (because gRPC libraries are large)
      3. Upload both zip files to s3 bucket
    4. From AWS console
      1. Create python lambda function "elder-mixer" using python 3.8 runtime
        1. Select VPC, subnet and security group to match server EC2 instance
      2. Upload elder-mixer.zip as lambda function (from s3 bucket)
      3. Upload grpc-layer.zip as lambda layer (from s3 bucket)
      4. Configure elder-mixer to use grpc-layer
      5. Invoke "test" on elder-mixer lambda, the "hello, world" test is OK
        1. The lambda does not care, but need an event which causes gRPC write to server
      6. Success means the lambda ran without errors and the server wrote a log message

elder-mixer's People

Contributors

guycole avatar

Watchers

 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.