DEV Community

Discussion on: 4 tips for AWS Lambda optimization for production

Collapse
 
nilamo profile image
Alex Winfield

Something I'd love to see more info on, is when you should drop Lambda and switch to just ec2 or fargate. Lambda is great for small scale things, but once your usage rises to a certain point, it'd be cheaper to just run a continuous instance.

And if you do so, can you keep some of your functions as Lambdas, and only use the API Gateway for the lambda functions? Because the API Gateway is also a cost-source that could spiral out of control.

There just doesn't seem to be very much discussion on how to scale out of lambda easily, unless you just move your whole endpoint out of the API Gateway. Incremental migration options would be terrific.

Collapse
 
taavirehemagi profile image
Taavi Rehemägi

On another note, if you are concerned about costs of your backend API, not about the scalability, performance and reliability of your application.. There is really no cost advantage if you compare Lambda and Fargate - both are serverless options with rather similar cost structure.

But when it comes to deploying your API just to EC2, you really should consider the Total Costs of Ownership. Implementing Load balancer, monitoring and maintaining those servers will most likely cost much more than just relying on serverless. Hope this helps :)

Collapse
 
nilamo profile image
Alex Winfield

See? That really just emphasizes that I have no idea what the upgrade path is once you start to exceed Lambda's free tier lol. Maybe Beanstalk, so all those things are still handled for you?

Collapse
 
taavirehemagi profile image
Taavi Rehemägi

Hey Alex! That's a good point and not that much content out there discussing this - we're volunteering to put some ideas out there re this ;)

Not sure if that's any help but we've discussed Lambda vs ECS briefly some time ago: dashbird.io/blog/amazon-ecs-vs-lam...