We had several goals in mind as we evaluated the various solutions:
- use API Gateway
- use Lambda
- have a way to test locally
- have a way to deploy to prod while managing everything as code
- integrate with existing Terraform infra.
Many of these items have point solutions, but there isn't a comprehensive solution that doesn't require a lot of copy/paste and extra verbosity. For example, you can achieve #1, #2 and #3 with Serverless Application Model (SAM), but you have to maintain two sets of "mappings", one in swagger and one in SAM template language. And creating an API Gateway by hand in Terraform is exremely verbose, often requiring 5 or 6 stanzas to define one simple GET /foo
endpoint.