Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use AWS API Gateway instead of an application load balancer?

I'm looking at this architecture diagram:

enter image description here

My ultimate goals is to deploy a ECS/Fargate cluster on AWS. I know that the ALB can be a bit expensive, and I was wondering if I could use API gateway instead. I'll still have a few containers running (maybe 2-3 max at the beginning) so I'd still need some sort of load balancing capability.

Is it possible?

like image 495
JPFrancoia Avatar asked Oct 22 '25 10:10

JPFrancoia


1 Answers

API Gateway is designed to be a front-end for native AWS services (mostly, Lambda), and handle things like authorization, rate limiting and some rudimentary caching. If your backend logic lives in a bunch of lambdas and you need a non AWS-aware client (like a mobile app or a SPA in a browser) call it over HTTP, API gateway is the way to go.

API gateway does support integration with HTTP endpoints, but no load balancing.

If your workload truly calls for compute instances (that is, long-running processes that persist a non-trivial state in memory or on a local drive, shared and updated by many concurrent units of work), then you'll need a load balancer of some kind.

If your units of work share no or minimal state in memory that can be easily hydrated from the database, you might be better of implementing it in lambdas. In this case, you can get away with an API gateway, as Lambda runtime will handle the balancing.

like image 129
Quassnoi Avatar answered Oct 24 '25 05:10

Quassnoi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!