简体   繁体   中英

When to use Application Load Balancer over API Gateway in AWS?

Assuming you need a single entry point for your apis/services, both ALB and Api Gateway are capable. But Api Gateway have more functions outside of routing traffic.

For routing traffic purposes, why would you use ALB over API Gateway? Is there a clear cut use case wherein ALB is preferable?

ALB integrates with existing web server infrastructure. So if you have an existing codebase it's a lot easier to integrate.

Also, in my opinion configuring ApiGateway is a lot of work and ALB works with almost no effort. They're just two very different products. ALB is a no nonsense load balancer and ApiGateway is a service which integrates nicely with CI/CD pipelines and serverless frameworks.

Generally the choice is upto you, but if you're trying to run a full API then I would suggest using API Gateway if you will use the feature set that it provides.

If you want to use any of the following with your API then API Gateway is going to be a definitive choice:

  • Authorization/individual client management (including throttling on an API key basis)
  • API backed by a Swagger/OpenAPI schema
  • SDK Generation
  • Lambda or partially Lambda driven (Lambdas are also supported as targets in an ALB target group).
  • Schema validation (Is the users input valid?) before it reaches your application

These are only some of the features of API Gateway, an ALB will replace like for like replacement and can support some of these features such as Lambda based target groups or canary deployments through proportional target group distribution.

Ultimately the choice comes to you over how you want to see your apps future driven, API Gateway in my opinion allows you to focus on building the application whilst API Gateway takes care of these other parts (after you configure it).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM