level 100

Gateway Proxy

Abstract access to platform services behind API Gateway

Context

In a serverless architecture, we weave low-level platform components with custom business logic. It is common for Lambda functions to essentially act as proxies to underlying platform services, without processing any logic. Lambda functions operate with account-wide concurrency limits and scalability constraints, and are subject to “cold start” latency. Requests proxied through Lambda are bound to the underlying performance of the Lambda platform.

Solution

Expose and abstract AWS platform components and other third-party or legacy services as RESTful HTTPs endpoints using API Gateway. API Gateway maps the incoming HTTP context and request data to an event that is passed to the downstream system.

Components

  • API Gateway
  • AWS Platform Component
API Gateway
API Gateway exposes an HTTP endpoint and maps requests to the integrated service.
AWS Platform Component
An AWS platform component such as Kinesis, SNS, SQS, or DynamoDb.

Notes

The Gateway Proxy is often coupled with Gateway Validation to ensure payloads are correct before mapping to the underlying service. Invalid requests are rejected by API Gateway before being sent to the integrated service. This can help reduce load and avoid costs associated with executing invalid processes.

API Gateway configuration is quite complex, especially for stateful services like DynamoDb. It might be simpler to use a thin Lambda client and the power of programming to abstract the work.


Cost Profile

Service Charge
API Gateway Request
API Gateway Data Transfer
AWS Platform Component Pricing as per complicated AWS guidelines

Related Patterns

Links