Amazon API Gateway Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 36: Line 36:
* HTTP(S) endpoints, representing client REST API services or web sites, can be integrated with [[#Proxy_Integration|HTTP proxy integration]] and [[#Custom_Integration|HTTP custom integration]].
* HTTP(S) endpoints, representing client REST API services or web sites, can be integrated with [[#Proxy_Integration|HTTP proxy integration]] and [[#Custom_Integration|HTTP custom integration]].
* Lambda functions can be integrated with [[#Proxy_Integration|Lambda proxy integration]] and [[#Custom_Integration|Lambda custom integration]].
* Lambda functions can be integrated with [[#Proxy_Integration|Lambda proxy integration]] and [[#Custom_Integration|Lambda custom integration]].
* AWS service endpoints () can only be integrated with [[#Custom_Integration|non-proxy (custom) integration]].
* AWS service endpoints ( [[Amazon Kinesis]] or [[Amazon S3]]) can only be integrated with [[#Custom_Integration|non-proxy (custom) integration]].


The integration type is defined by how the API Gateway passes data to and from the integration endpoint:
The integration type is defined by how the API Gateway passes data to and from the integration endpoint:

Revision as of 01:44, 5 February 2019

External

Internal

REST and Hypermedia Concepts

Resource, Method, Request, Response

Amazon API Gateway

Amazon API Gateway is the preferred way to expose internal AWS endpoints to external clients, in form of a consistent and scalable programming REST interface (REST API). Amazon API Gateway can expose the following integration endpoints: internal HTTP(S) endpoints - representing custom services, AWS Lambda functions and other AWS services, such as Amazon Kinesis or Amazon S3. The backend endpoints are exposed by creating an API Gateway REST API (RestApi) and integrating API methods with their corresponding backend endpoints. Each of the backend endpoints specified above is associated with an integration type.

Amazon Gateway URL

The URL is determined by a protocol (HTTP(S) or WSS), a hostname, a stage name and, for REST APIs, the resource path.

Amazon Gateway API Base URL

The hostname and the stage name determine the API's base URL.

Amazon Gateway Hostname

https://{restapi-id}.execute-api.{region}.amazonaws.com

Integration

Integration Endpoints and Types

Amazon API Gateway can serve three types of backend endpoints, and can also simulate a mock integration endpoint:

The integration type is defined by how the API Gateway passes data to and from the integration endpoint:

Proxy Integration

In general, proxy integration implies a simple integration setup with a single HTTP endpoint or Lambda function, where the request is passed with minimal, or no processing at all, to the backend. Because of that, the backend can evolve without requiring updates or reconfiguration of the integration point in the API Gateway.

Custom Integration

Custom integration implies a more elaborated setup procedure. Among other things, it allows for reuse of configured mapping templates for multiple integration endpoints that have similar requirements of the input and output data formats. Since the setup is more involved, custom integration is recommended for more advanced application scenarios.

Integration Types

Integration Request

Integration Response

Also see IntegrationResponse below.

Mapping Template

Amazon API Gateway Resources that Require Redeployment

Where are these resources living?

RestApi

Resource

Method

RequestValidator

MethodResponse

Integration

IntegrationResponse

Also see Integration Response above.

GatewayResponse

DocumentationPart

DocumentationVersion

Model

ApiKey

Authorizer

VpcLink

Amazon API Gateway Resources that Require Configuration Changes without Redeployment

Account

Deployment (API Deployment)

A Deployment resource represents a REST API deployment in Amazon API Gateway. The Deployment is like an executable of an API represented by a RestApi resource. Once an RestApi is created, it requires deployment and association with a stage to make it callable by its users. To call a deployed URL, clients submit requests against the API's URL.

Resource updates require redeploying the API, whereas configuration updates to not.

DomainName

BasePathMapping

Stage

Stage

An API stage is represented by a Stage resource and represents a named reference to a deployment, and at the same time, a snapshot of the API, including methods, integrations, models, mapping templates, Lambda authorizers, etc.

Usage

UsagePlan

API Documentation

See DocumentationPart and DocumentationVersion above.

X-Ray Integration

API request latency issues can be troubleshot by enabling AWS X-Ray. AWS X-Ray can be used to trance API requests and downstream services.