Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the use cases for application load balancers and Lambda?

On ReInvent last week, one of the announcements made was that an ALB can now invoke Lambas to serve HTTPS request. Since we can already connect API Gateway to Lambdas, I'm a bit puzzled as to what problem this new feature solves.

This is the annoncement - https://aws.amazon.com/about-aws/whats-new/2018/11/alb-can-now-invoke-lambda-functions-to-serve-https-requests/

Can someone please give some examples?

like image 496
Daniel Avatar asked Dec 06 '18 06:12

Daniel


2 Answers

The problem this solves is that it allows yet another way to use Lambda functions to handle HTTP requests and generate responses.

...but you can already do this with either API Gateway or CloudFront's Lambda@Edge feature.

So, what problem does it really solve?

Simplified integration of Lambda request handling into server-centric applications that use ALB.

While this feature offers, in some sense, a subset of API Gateway's capability, it differs in an important way -- by allowing you to easily "mount" Lambda functions into a specific set of paths in your existing EC2-based application.

You can pick off specific path patterns and send only those to the Lambda function(s) -- under the same domain without any cross-domain complexity, and without needing to proxy the request through your EC2 instances -- while continuing to serve the rest of the app from EC2. Avoiding cross-domain resources within an application simplifies many things, not the least of which is cookies and sessions.

While you could also use this in some cases to replace what API Gateway can do, the idea isn't really that you'd set an ALB exclusively for Lambda functions, although of course you could do that.

like image 112
Michael - sqlbot Avatar answered Oct 06 '22 22:10

Michael - sqlbot


This is a great announcement, truly an enabler for Serverless Architecture. In my view, i feel following use cases are now making more sense:

  • Listeners on ALB where port 80 and port 443, now you can route your traffic to different lambda function on basis of port listener. Port 80 will call a different lambda function and port 443 will call different.
  • Host based routing
  • Application path based routing

now this will enable us to route requests starting with /application triggers Lambda Function.

like image 38
Yash Bindlish Avatar answered Oct 06 '22 21:10

Yash Bindlish