Code Monkey home page Code Monkey logo

serverless-alb-lambda's Introduction

Serverless backend with ALB

serverless framework with a load balancer (with vpc/subnet configuration) connected to a lambda in aws.

  • creates a LoadBalancer, HTTP Listener and Lambda
  • links the Listener and Lambda
  • stores the LoadBalancerDNSName (url) in ParameterStore

Install Requirements

npm install serverless -g
npm install

Modify Config

Modify the file /config/serverless.config.yml

  • VPC / Subnet configuration for load balancer
  • Scheme for load balancer
    VPC_ID: 'vpc-xxxxxxxxx'
    SUBNET_ID_A: "subnet-xxxxxxxxx"
    SUBNET_ID_B: "subnet-xxxxxxxxx"
    SUBNET_ID_C: "subnet-xxxxxxxxx"
    SCHEME: "internet-facing" or "internal" # load balancer scheme - 

Deploy solution

sls deploy

Result:

  1. Execute info to get load balancer url
sls info -v

you should get the full output containing the load balancer url.


Stack Outputs
LoadBalancerDNSName: serverless-load-balancer-258977035.eu-central-1.elb.amazonaws.com
HandlerLambdaFunctionQualifiedArn: arn:aws:lambda:eu-central-1:368555349508:function:serverless-load-balancer-dev-handler:1
ServerlessDeploymentBucketName: serverless-load-balancer-serverlessdeploymentbuck-16pgpyls1225e
  1. Paste the LoadBalancerDNSName Value into your browser or execute postman to set a GET statement against the URL.

Expected Response:

    Successfully executed lambda call via loadbalancer

serverless-alb-lambda's People

Contributors

komalsingh54 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.