Amazon API Gateway のアイコン

Amazon API Gateway Popular2015年〜

A fully managed service for creating, publishing, managing, and monitoring APIs

What It Does

Amazon API Gateway is a fully managed service for creating, publishing, and managing REST APIs, HTTP APIs, and WebSocket APIs. It provides API endpoints (entry points) and forwards incoming requests to backend services such as Lambda functions and EC2 instances. With built-in features for authentication, throttling (rate limiting), caching, and CORS configuration, it has everything you need to operate APIs.

Use Cases

API Gateway is used for backend APIs for mobile apps and single-page applications (SPAs), API gateways in microservices architectures, publishing APIs to third parties, exposing Lambda functions as HTTP endpoints, and modernizing legacy systems with APIs - essentially any scenario that involves serving APIs.

Everyday Analogy

Think of it like a hotel front desk. Guests (clients) communicate their requests to the front desk (API Gateway). The front desk routes each request to the appropriate department - room service, housekeeping, or the concierge (backend services). Guests don't need to know how things work behind the scenes; the front desk serves as a single point of contact.

What Is API Gateway?

Amazon API Gateway is a service for creating and managing APIs at any scale. An API (Application Programming Interface) is a gateway through which applications exchange data. For example, when a smartphone app retrieves data from a server, it sends a request through an API and receives a response. API Gateway serves as this gateway, providing common features like security and rate control in a centralized manner.

Types of APIs

API Gateway supports three types of APIs. REST API is the most feature-rich, with advanced capabilities like API key management, usage plans, and request validation. HTTP API is a simplified version of REST API that costs about 70% less and is ideal for Lambda and HTTP backend integrations. WebSocket API supports real-time bidirectional communication, making it suitable for chat apps and real-time dashboards.

Integration with Lambda

The combination of API Gateway and Lambda is a classic serverless architecture pattern. API Gateway receives HTTP requests from clients, invokes the corresponding Lambda function, and returns the response. With no server management required and fully pay-per-request pricing, it scales flexibly from small APIs to large-scale ones. You can learn the fundamentals and advanced patterns of Lambda integration from reference books on Amazon.

Getting Started

To get started with API Gateway, click "Create API" in the API Gateway console. Select the API type, define resources (URL paths) and methods (GET, POST, etc.). Specify a Lambda function as the integration target, and your API is ready in minutes. Click "Deploy API" to deploy to a stage, and a public URL is issued.

Things to Watch Out For

  • REST API and HTTP API differ in pricing and features, so choose the type that fits your requirements. HTTP API is more cost-effective for simple use cases
  • Without proper throttling settings, backend services may be overwhelmed with excessive load
  • The free tier includes 1 million REST API requests and 1 million HTTP API requests per month for 12 months
共有するXB!