Re:Lambda on hard mode: serverless HTTP in Rust
by jvanderbot on Sunday March 17, 2024 @09:38PM
(#39739752)
Yep exactly how I do it. API gateway is such a pain, just to specify a default route pointing to the lambda. But it's a one time setup.
Like yourself I use Axum, and pretend AWS lambda doesn’t exist. By default I use the standard HTTP server for local development, I then have an environment variable to toggle lambda mode for when running in lambda. If I wanted to I can run the app anywhere, lambda, ec2, eks, fargate, 3rd party vps/server.
Using Cargo Lambda and its associated AWS CDK plugin it cross compiles to ARM64, sets up AWS stacks with databases or other resources, removes a bunch of manual tasks.
The only thing that is inconvenient is you can not use custom domains for function urls. If you need a vanity name, you have to go via api gateway and associated costs. That’s by design though.
The monolith lambda works well. The KISS approach