Giter VIP home page Giter VIP logo

api-gateway-lambdas's Introduction

Lambdas with API Gateway - CDK

This sample project displays how to create AWS Lambdas behind an API Gateway using CDK.

Structure

The structure of this project is meant to have the actual domain logic loosely coupled to the AWS and HTTP specifics. All domain logic is in the commands module, which then depends on the kernel module. This means that we have to transform the payloads and response that are send to or comes from the commands module to work with the ones expected by the the Lambda runtime, which is achieved through the aws module in this project (see makeLambdaHandler at aws/index.ts);

External dependencies (NPM)

The Lambda packager/builder is smart enough to only pick up the dependencies needed by each specific Lambda Function. For example, the SumNumbers function uses the bignumber.js NPM package to perform its (very advanced) calculation, and even though this dependency comes from node_modules in the root of the source code, when we build the CloudFormation Stack, this module is only included in the SumNumbers Lambda.

Pros & Cons

Pros

  • clean microservices-oriented architecture;
  • clear separation between Domain and Transformations;
  • less costs as we only pay per execution time;
  • much less infra to manage;
  • auto-scaling, caching, monitoring...;
  • (as) easy (as possible) to switch to different cloud providers or self-hosting;

Cons

  • more complex code than running express behind the Lambda or in an EC2;
  • more code as we need transaformers πŸ€–πŸ¦ΎπŸ¦Ώ;
  • more complex deployment process;

api-gateway-lambdas's People

Contributors

pedromtcosta avatar

Watchers

James Cloos avatar  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.