Search code examples
serverlessserverless-frameworkaws-api-gatewayserverless-architecture

Share multiple api gateway in one serverless compose service


I have a project with serverless framework compose following this architecture

/services
    --- infra
    --- service-a
    --- service-b

The 'infra' service create and share two api-gateway (a private and public one), but in each service a can use only one. In each service a have a public lambda for creating an object (public api) and a lambda to approuve the object by an admin (private api).

I need this specific pattern cause it's a medical project. How I can do select an api gateway for each lambda ?


Solution

  • there's no "good" way to do it if you need to have two different APIGWs in the same Serverless service. The best approach would be to separate it into more services, e.g. service-a-public, service-a-private, and so on.

    If you really need to use a single service that uses two separate APIGWs, then you need to write the integration as raw CloudFormation.