Common Amazon API Gateway Patterns for microservice architecture:

Common Amazon API Gateway Patterns for microservice architecture:

API Gateway:

API Gateway is a fully managed service that allows to create RESTful and WebSocket APIs at any scale. API Gateway handles all the tasks involved in accepting and processing up to hundreds of thousands of concurrent API calls, including traffic management, CORS, authorization, throttling, monitoring, and version management.

It provides end users with the lowest possible latency for API requests and responses by taking advantage of AWS global network of edge locations using CloudFront.


API Gateway Pattern:

The API gateway pattern is recommended if you want to design and build a microservices-based applications with multiple client applications. API gateway provides a single endpoint or URL for the client applications, and it internally maps the requests to internal microservices.

This can be achieved in multiple ways:

  • One API gateway for all microservices
  • Main API gateway, which routes traffic to specific API gateways of each service
  • One main Load Balancer in front of multiple API gateways


Use Case:

A customer makes a payment in a system that consist of 4 microservices deployed as Lambda functions ("Customer","Communication","Payment" and "Sales").

  • Customer service updates the customer database with the payment details.
  • Sales microservice updates the sales database.
  • Communication service sends a communication email to the customer after payment is successfully processed.

Payment microservice is the overall system that the customer uses to make payment.


Unified API gateway:

In the following illustration, each microservice is deployed as a Lambda function but all microservices are connected by the same API gateway.


Main API Gateway with gateway per service:

In the following illustration, each microservice has its own API gateway. The "Payments" microservice calls out individual systems and implements the API gateway pattern.


Load Balancer in front of multiple API gateways:

This solution allows you also to have other targets along with API gateway, like EC2, Load Balancers, etc.



Challenges:

  • Synchronous calls are made to downstream systems, therefore latency caused by these subsystems affects the overall response time.
  • Running costs are higher because the main system is waiting for responses from the other microservices before responding to the calling system. The total running time is higher compared with an asynchronous system.


Summary:

This article explored three approaches for using an API Gateway in a microservices architecture:

  • Deploying a single, unified API Gateway for all services.
  • Using a central API Gateway that routes to individual gateways for each service.
  • Implementing a Load Balancer to manage multiple API Gateways.

Each method has its advantages and drawbacks. The unified API Gateway is the most cost-effective, while the Load Balancer setup offers the highest level of robustness.

要查看或添加评论,请登录

Amit Kumar的更多文章

  • ?? Deploying Microservices in AWS EKS using Ingress resource

    ?? Deploying Microservices in AWS EKS using Ingress resource

    In my previous article, I demonstrated how to deploy separate Load Balancer services for each microservice in AWS EKS…

    1 条评论
  • Microservices deployment in EKS

    Microservices deployment in EKS

    ?? Deploying Orders & Products Microservices in AWS EKS: Let’s do a hands-on deployment of Orders & Products…

    10 条评论
  • What is Disaster in terms of cloud computing?

    What is Disaster in terms of cloud computing?

    A disaster refers to any unexpected event or situation that disrupts the normal operations of cloud-based systems…

    4 条评论
  • Monolith to microservice

    Monolith to microservice

    Let’s discuss the difference between monolith and microservice first, 1. Architecture: In Monolith arch, application is…

    6 条评论
  • AWS Well-Architected Framework

    AWS Well-Architected Framework

    AWS Well-Architected Framework Overview The AWS Well-Architected Framework is a set of best practices designed to help…

    2 条评论
  • ALL ABOUT AWS LAMBDA SERVICE

    ALL ABOUT AWS LAMBDA SERVICE

    AWS Lambda Overview AWS Lambda is a serverless compute service provided by Amazon Web Services (AWS). It allows to run…

    7 条评论
  • Taco Bell's Event-Driven Architecture with AWS Serverless Services

    Taco Bell's Event-Driven Architecture with AWS Serverless Services

    Taco Bell serves over 42 million customers weekly across 7,000+ restaurants. To streamline and optimize their order…

    3 条评论
  • AWS Elastic Container Service (ECS)

    AWS Elastic Container Service (ECS)

    Overview of ECS AWS Elastic Container Service (ECS) is a scalable container management service that allows you to…

  • Building a Secure and Scalable API Architecture for Enterprise Applications

    Building a Secure and Scalable API Architecture for Enterprise Applications

    In this article, I am trying to explain a secure, scalable, and resilient API architecture which I implemented for my…

    2 条评论
  • EC2 Cost Optimization

    EC2 Cost Optimization

    Let’s focus on smart savings, not just cutting costs indiscriminately. Remember, not all savings are truly beneficial.

    6 条评论

社区洞察

其他会员也浏览了