Getting started with API Gateway
API Gateway is an AWS serverless API proxy service that allows you to create a single and unified entry point for all of your Lambda functions. It proxies and routes the incoming HTTP requests to the appropriate Lambda function (mapping). From a server-side perspective, it's a facade or a wrapper that sits on top of Lambda functions. However, from a client's perspective, it's just a single monolithic application.
In addition to providing a single interface to the clients, and its scalability, API Gateway provides powerful features such as the following:
- Caching: You can cache endpoint responses, hence reducing the number of requests made to the Lambda functions (cost optimization) and enhancing the response time.
- CORS configuration: By default, the browsers deny access to resources from a different domain. This policy can be overridden by enabling Cross Origin Resource Sharing (CORS) in the API Gateway.
Note
CORS will be discussed in-depth in Chapter 9, Building...