level 100

Function as a Web Service

In the beginning was the Lambda.

Context

In a serverless architecture, we use Lambda functions to provision services that execute business logic. Services should be maintainable, testable, independently deployable, and loosely coupled with other services.

Solution

Expose Lambda functions 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 Lambda function

Components

API Gateway
API Gateway exposes an HTTP endpoint and maps requests to the integrated service.
Lambda Function
A Lambda function handles business logic and returns JSON data encapsulating HTTP Status Code, Headers and a message Body.

Notes

Direct invocation of Lambda functions creates coupling between our services. Consumers that rely on directly invoking a function are coupled to the internal implementation of the service.

Map API Gateway endpoints to a custom domain to further decouple services and allow teams to evolve the internal service architecture independently.


Cost Profile

Service Charge
API Gateway Request
API Gateway Data Transfer
Lambda Request
Lambda Compute Time x Memory
CloudWatch Log Data Ingestion