Skip to content
Related Articles

Related Articles

Amazon Web Service – Introduction to API Gateway

Improve Article
Save Article
  • Difficulty Level : Easy
  • Last Updated : 23 Nov, 2022
Improve Article
Save Article

Firstly, API stands for Application Program Interface. An API Gateway is a management tool that acts as an interface between users and microservices. The Amazon API Gateway is an AWS service that allows users to create, publish, secure, maintain and monitor APIs at any scale. You can create APIs in your own client application and can also make them available to third-party developers. It is serverless. It supports HTTP, WebSocket, and REST APIs. API Gateway is a type of server that provides the service of API which is used to customize each client. 

The Netflix API Gateway is the most popular example of API Gateway. Many e‑commerce site uses an API gateway so as to provide the endpoint for retrieving the details of all products from mobile clients with only single request. So, This invokes many different services like the proper information of product, product reviews and then combines the results.

 Key Terminologies:

Following are some keywords that you need to be familiar with to get a better understanding of the article:

  • HTTP (HyperText Transfer Protocol) API is an application layer protocol that helps to communicate over the World Wide Web to get the data.
  • REST (Representational State Transfer ) API takes the HTTP standards to perform operations of GET, POST, PUT, PATCH, and DELETE on the data.
  • WebSocket is a device communication protocol that provides point-to-point system communication channels over a single TCP. It enables stateful, full-duplex communication between client and server.

The API Gateway handles the following aspect of development:

  1. Traffic Management
  2. CORS support
  3. Authorization, authentication and Access Control
  4. Request routing, shaping and Management
  5. Throttling (The process of limiting the number of API requests a user can make in a certain period)
  6. API health Monitoring
  7. API version Management
  8. Load balancing
  9. Caching
  10. Static response handling
  11. Protocol translation
  12. Composition

Cost of AWS API Gateways

You pay for use only, i.e you pay for the API calls you receive and the amount of data transfer. There is an optional data caching charged at an hourly rate that varies based on the cache size you select.

Amazon also provides free tier services for up to 12 months, which includes:

  • 1 million HTTP API calls
  • 1 million REST API calls
  • 1 million messages
  • 750,000 connection minutes per month      

Take a look at the below table for standard pricing of Amazon API Gateway or visit this page:

                                              Pricing for the API Calls                                 
         APIs      No. of requests per month  Price(per million)             
HTTP First 300 million   $1.00
  300+ million   $0.90
REST First 333 million   $3.50
  Next 667 million   $2.80
  Next 19 billion   $2.38
  Over 20 billion   $1.51
WebSocket First 1 billion   $1.00
  Over 1 billion   $0.80


Architecture of API Gateway

The below diagram shows how the APIs built-in Amazon API Gateway provides customers with an integrated and consistent developer experience for building AWS serverless applications. It acts as a gateway for applications to access data from your backend services such as code running on Amazon Elastic Compute Cloud (Amazon EC2),  AWS Lambda, any web applications, etc.

Architecture of API Gateway


The entire architecture of AWS API Gateway consists of the below key components:

  1. Amazon API Gateway: It is used to create, publish, secure, maintain and monitor APIs.
  2. API Gateway Cache: Users can enable API caching to cache their endpoint responses,  which can reduce the number of calls made to the endpoint and also improve the latency of API requests.
  3. Amazon Cloud Watch: It is a monitoring and observability service. It collects monitoring and operational data and visualizes it using automated dashboards, which allows users to visually monitor calls to their services.

Working with Amazon API Gateway:

The Amazon API Gateway can be accessed through the following:

  1. AWS Management Console
  2. AWS SDKs, API Gateway V1, and V2 APIs
  3. AWS Command Line Interface
  4. AWS Tools for Windows PowerShell

For example,  if you want to create an HTTP API, first, you have to create a lambda function and for creating a lambda function, you have to use the lambda service of AWS, then you have to create HTTP API using API Gateways followed by testing the API.

Let us look at AWS  API Gateways on the AWS management console. Login to your AWS account. Once you are redirected to the AWS management console. Click on “Services”. Search on the search bar for API Gateways. Refer to the given image:


Advantages of Using API Gateways:

Following are the advantages of using the API Gateway:

  • It helps in efficient API development. Users can run multiple versions of the same API simultaneously with API Gateway, allowing users to quickly iterate, test, and release new versions.
  • It provides the lowest latency possible latency (time taken by data to pass one point in the network to another)  for API requests and responses.
  • Users can easily monitor performance and information using the API Gateway dashboard.
  • It is cost-saving at scale i.e user can decrease their costs as their API usage increases per region across their AWS accounts.
  • It gives flexible security control by providing access to APIs with AWS Identity, Access Management (IAM), and Amazon Cognito.
  • With API gateways, the coding efforts reduces which makes the application more efficient. Also, there is less chances of errors all at the same time.
  • The API Gateway helps to encapsulates the internal structure of many application.
  • In API Gateway, the client directly talks rather than invoking the specific service.
  • Handling multiple API’s handling is much easy with API gateway.

Disadvantages of API Gateways:-

Following are the disadvantages of using the API Gateway:

  • Not much Secure. Many a times, it is very difficult to implement  the security practices in every API call. From which leads to difficulty in tracking their performance.
  • API gateway is tough to consider as reliable.
  • It is very difficult to maintain API gateway updates regularly with the inclusion of every microservice.  So, when a single application turns into the services of millions of microservices then this becomes very hectic to handle.
  • API gateway requires the routing rules. so, there are much more possibility of failure from a single point. 
  • In API Gateway, there are all the API rules in one place. So, there is Risk of complexity.
My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!