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.
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
- 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.
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.
|API Gateway||Data Transfer|
|Lambda||Compute Time x Memory|
|CloudWatch||Log Data Ingestion|