Skip to content
Related Articles

Related Articles

Amazon Web Service – Introduction to API Gateway

View Discussion
Improve Article
Save Article
Like Article
  • Difficulty Level : Easy
  • Last Updated : 28 Mar, 2022

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.

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 and Access Control
  4. Throttling (The process of limiting the number of API requests a user can make in a certain period)
  5. Monitoring
  6. API version Management

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:

 

Benefits of Using API Gateways:

Following are the benefits 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.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!