Search code examples
aws-lambdamicroservicesaws-api-gatewayopenapiapi-gateway

Presenting Serverless Microservices


I've used microservice architecture for years. I've also used serverless functions for years. But I've never found a neat was to present groups of serverless functions as microservices.

Server based approach

I'm a big fan of presenting HTTP APIs (internal and external) using OpenAPI specs. It enables a self-updating UI (Swagger) as well as the ability to generate SDKs.

In a server based architecture, each microservice would have its own OpenAPI spec (generated using something like Springfox, Swashbuckle etc). Then the overall system's public API Gateway would have its own spec, exposing the relevant internal calls.

Serverless equivalent?

I'm aiming to implement a serverless-microservice architecture on AWS. Replacing webserver-based logic with collections of Lambda functions isn't an issue. My question is: How do you present a collection of related Lambda functions as a microservice?

Are private gateways the right tool for the job?

I've considered using private API Gateways to present groups of Lambda functions. This would mean having a public API Gateway, pointing to multiple private Gateways. I've not seen this approach used before (which is why I question it being the optimal answer). I'd welcome any criticism of it as well as alternative ways to achieve the same thing.


Solution

  • My phone buzzed this morning and this Medium article popped up.

    Seems to validate the private Gateway approach. Credit to Mehmet Ozkaya.