4 ms·
I write Lambda functions in golang. In dev I run the function as local http server. In prod I map a custom domain to the lambda, routing is done internally to t
by mozey 5y ago
I write Lambda functions in golang. In dev I run the function as local http server. In prod I map a custom domain to the lambda, routing is done internally to the function. API Gateway is only used for the top level route. This workflow is enabled by https://github.com/apex/gateway https://github.com/apex/gateway
In principle I try to avoid Amazon Web Services that lock me into the platform. So, for my dev stack I run a few other containers to give me the equivalent of the prod environment, RDS (MySQL or PostgreSQL), ES (OpenDistro), S3 (Minio), and SES
https://github.com/mozey/aws-local https://github.com/mozey/aws-local
Dev is easy because I can test everything locally, and the resulting code should be portable to any other cloud.
Obviously this approach might not be feasible if you choose to use AWS that do not have equivalent self-hosted options.
- ngrilly 5y agoSeems like you use Lambda to host an HTTP service? apex/gateway is really nice to implement the server using standard Go net/http interfaces instead of proprietary AWS SDK. But why not use ECS instead of Lambda and just host containers running your HTTp service?
- mozey 5y agoLambda because pricing, I don't have to pay the per hour fee if the service is not used every hour/day/etc. By using apex/gateway I can easily move the code to ECS if that becomes the better option.