Hey everyone! We're relatively new to developing microservices and have been using AWS with Terraform to manage our infrastructure. Each of our microservices is set up with its own API Gateway, which was straightforward during deployment. However, as we look to add an additional microservice that the frontend will rely on, I've started questioning this approach.
I'm considering consolidating everything behind a single API Gateway instead. Here's my reasoning:
- Having separate API Gateways for each service feels like unnecessary bloat, leading to additional CloudFront instances and multiple subdomains.
- It could complicate things for our frontend developers with all those subdomains.
- It seems more in line with CNCF infrastructure principles, which favor having a single API Gateway or service mesh with multiple backend services.
- API Gateway supports multiple integrations, which could simplify things.
- Using a single Lambda authorizer for JWT validation sounds more efficient than implementing one for each gateway.
I'd love to hear your thoughts on whether this direction makes sense!
5 Answers
Absolutely! Having separate API Gateways can lead to significant overhead. An API Gateway is essentially designed to manage routing and can effectively handle multiple services with ease. By consolidating to one, you streamline your infrastructure.
If you need to balance loads or use something like ECS with service discovery later on, that's still possible.
You’re on the right path!
I’d advise against putting everything behind one API Gateway. This approach could create a single point of failure in your system and make it harder to scale your services independently. Keeping them separate allows for better management and isolation when problems arise.
I think your concerns about bloat are valid. Consolidating to one API Gateway can help cut down complexity. Just keep in mind, it might introduce a single point of failure. Ensure your gateway is reliably configured to manage potential issues that could affect multiple services at once.
Good advice! It’s crucial to weigh the pros and cons and have a solid strategy before making that switch.
I like the idea of a single point for user-facing traffic, but be careful with mixing responsibilities. Each microservice should handle its own routes, so just ensure your gateway setup minimizes the risks associated with interdependence.
Definitely considering a single API Gateway makes sense if you have multiple services. Just think about your expected load per service, as this will impact costs and manageability. Be sure you have a solid auth model that segregates services effectively to avoid complications later.
Great point! I've seen similar setups where services communicate through a broker, and that’s the best way to avoid complexity.