Application Load Balancers vs API Gateway

Mehran picture Mehran · Jun 30, 2019 · Viewed 9.8k times · Source

AWS comes with a service called Application Load Balancer and it could be a trigger to a lambda function. The way to call such a lambda function is by sending an HTTP/HTTPS request to ALB.

Now my question is how this is any different from using the API Gateway? And when should one use ALB over API Gateway (or the way around)?

Answer

Chris D'Englere picture Chris D'Englere · Jul 3, 2019

One of the biggest reasons we use API gateway in front of our lambda functions instead of using an ALB is the native IAM (Identity and Access Management) integration that API GW has. We don't have to do any of the identity work ourselves, it's all delegated to IAM, and in addition to that, API GW has built-in request validation including validation of query string parameters and headers. In a nutshell, there are so many out of the box integrations what come with API GW, you wind up having to do a lot more work if you go the route of using an ALB.