In this series of blog posts, I will cover API gateway in general and particularly AWS API gateway, what it is, how we can use it to the full extent and what are some best practices we can follow while doing so. Before going into the details let's first discuss what is API Gateway.
What is API Gateway in general?
In recent times, microservices have gained a lot of popularity with that the use of API gateway, what is it, why do we need it, and why can't we hit the microservices directly? I am assuming that you know the basics about microservices architecture and monolith architecture, if not here is a good place to know more about them.
so what is an API gateway, this is nothing but a reverse proxy that sits between your microservices or your backend services, it acts like a single point of entry to your backend services, and it offers a lot of functionalities
Single Entry Point: It acts as a single point of entry to the client applications, rather than clients dealing with multiple backend or microservices they can just hit the API gateway which in turn will route the client request to the appropriate microservice.
Request Routing: Based on the route URL, headers and other things API gateway will route the client requests to the correct microservice, it will also act as a load balancer.
Security and Authentication: It can act as a security layer, it is capable to validate the access token by which it can handle authorization and authentication, by this it will handle invalid or unauthorized access to the backend services.
Rate Limiting and Throttling: It can also help implement rate limiting on certain resources, which in turn avoids the** DDoS **attacks or it can avoid overloading of the system by which we can make sure that the system is more stable.
Caching: It can also act as a cache, where it will cache the redundant calls to microservices and serves the response without actually making the call to the microservice, which will improve the latency and performance of the application.
Logging and Monitoring: It can also log incoming requests and responses so that we will have a better understanding of the system behavior, this will help in troubleshooting or future enhancements
Version Management: When introducing changes to microservices, version management can be challenging. The API Gateway can handle versioning and ensure that clients interact with the correct version of the API.
I hope you got a good basic understanding of what API gateway is and how it can be useful, in upcoming posts in this series I will cover how we can achieve all these functionalities using the AWS API gateway.
Top comments (1)
What about service discovery? Is that also a responsibility of API gateway?