AWS - Introduction to API Gateway

Subscribe Send me a message home page


Table of Contents

Related Readings

Introduction

Amazon API Gateway is a service for creating and managing APIs. It can be used as the "front door" of many other AWS services. Here we present one of the classic architecture that uses API Gateway.

API_Gateway_Architecture.png

As we can see in the diagram above, API Gateway sits between client applications and AWS services, such as AWS Lambda, EC2 and it's actually the entry point of those services. The diagram has three blocks, which corresponds to three-tier architecture. Starting from the left, the first block is the presentation tier. It usually contains UI or web applications. The middle orange block represents the logic tier. This is where business logic sits. The right most block represents data tier.

Combined with AWS Lambda function, API Gateway is a powerful tool to build serverless systems. As a service, it's main responsibility is to create and manage APIs and it is completely decoupled from any business logic and implementation details.

Features of API Gateway

Key Concepts

API_Gateway_Integration.png

API Gateway and WebSocket

Recall that unlike http requests which follows the request-and-response model, WebSocket is a two-way communication and an open connection is maintained between clients and servers. Moreover, the backend on the server side can send callback messages to connected clients.

http_and_websocket.png

With API Gateway, we don't necessarily need servers and API Gateway service behaves as if there are servers backing up the APIs.

API_Gateway_and_WebSocket.png

Route for WebSocket APIs

Copied from AWS website

A WebSocket route in API Gateway is used to direct incoming messages to a specific integration, such as an AWS Lambda function, based on the content of the message. When you define your WebSocket API, you specify a route key and an integration backend. The route key is an attribute in the message body. When the route key is matched in an incoming message, the integration backend is invoked. A default route can also be set for non-matching route keys or to specify a proxy model that passes the message through as-is to backend components that perform the routing and process the request.

----- END -----

Send me a message Subscribe to blog updates

Want some fun stuff?

/static/shopping_demo.png


Comments