Besides what others commented about concurrent reqs in EC2 vs independent lambda execution costs, the trick considering all that is that Lambda is more efficient in terms of costs than EC2 UP UNTIL a certain amount of reqs/s, from that threshold onwards, the appropriate EC2 instance is cheaper. Engineers at BBVA came to this conclusion and wrote the whole analysis they made: https://www.bbva.com/en/innovation/economics-of-serverless/ Answer from HarrityRandall on reddit.com
Reddit
reddit.com › r/aws › why is everyone saying lambda is more expensive than ec2?
r/aws on Reddit: Why is everyone saying Lambda is more expensive than EC2?
May 23, 2023 -
Please help me work out the math here, as I think I am doing this wrong.
A Lambda of 128mb costs $0.0000000021/ms, this works out $0.00756/hour. A Lambda of 512mb costs $0.0000000083/ms, this works out $0.02988/hour.
Now if you look at EC2:
t4g.nano $0.0042/hour (0.5 GiB ram) t4g.micro $0.0084/hour (1GiB ram).
But... the Lambda will likely not run 100% of the time, and will stay warm for 10 minutes (not sure here?). And the RAM usage would be much better utilized if you got a function running, rather than an entire VPC.
Given all that, if the function can run with 128mb or less, it seems like a no-brainer to use Lambda.
However, if the function is bigger, it would only make sense to put it in an EC2 if it runs more than 30% of the time ($0.0084/hour cost of t4g.micro divided by 0.02988/h cost of 512mb lambda).
So why is everyone against Lambdas citing costs as the primary reason...?
Top answer 1 of 39
124
For EC2 you can run more than 1 request at the same time. For lambda it is 1 lambda per request. If you have even a few concurrent requests you lambda cost can 5-10x noting all the cold start and other times too.
2 of 39
100
If you expect to not have traffic 24x7 and low concurrent usage then Lambda may end up working out to be cheaper. Lambda is extremely expensive for my company because we have hundreds or thousands of concurrent executions.
Trek10
trek10.com › homepage › blog listing › aws lambda pricing in context - a comparison to ec2
AWS Lambda vs EC2 Cost Comparison - Trek10 | Trek10
How much compute would your EC2 ... instance, the m4.large instance type. It has 2 vCPU and 8 GB RAM and costs $0.12/hr or approx $86/month in the N....
AWS Lambda provisioned concurrency vs EC2 – SQLServerCentral Forums
If the apps/scripts you are running are under 10 minutes execution then AWS Lambdas would be ideal. I mean, anything really short duration shouldn't be on an EC2 unless there is a security feature you cannot get with AWS Lambda that you need with an EC2. The idea of running VM's is a huge cost, ... More on sqlservercentral.com
amazon web services - AWS EC2 vs Serverless Cost Comparison - Stack Overflow
Now I want to convert the EC2 server to the Serverless Platform i.e(API Gateway and Lambda). I have also followed different blogs and I am ready to go with the serverless. But, my one concern is on pricing. How can I predict per month cost for the serverless according to my use of EC2? More on stackoverflow.com
Why is Lambda considered more expensive than EC2 for serverless computing? - LambdaTest Community
For example, a 128MB Lambda costs $0.00756/hour, while a t4g.nano EC2 instance (with 0.5GB RAM) costs $0.0042/hour. I’m considering using Lambda, but I’m not sure where the cost concerns come in. If a Lambda doesn’t run 100% of the time, and assuming it stays warm for 10 minutes, shouldn’t ... More on community.lambdatest.com
Lambda vs ec2 costs for API
Much of my work involves companies frantically scrambling to get off of ec2’s into serverless because the cost of maintaining ec2 makes little sense if their system is event driven. I would start serverless and only add an ec2 if there’s literally no other service that can help you. More on reddit.com
Videos
02:32
Lambda or EC2? - YouTube
16:25
AWS Lambda vs EC2: What to choose for your company and why? - YouTube
AWS Lambda Vs EC2 | Serverless Vs EC2 | EC2 Alternatives
16:50
AWS EC2 vs ECS vs Lambda | Which is right for YOU? - YouTube
19:52
AWS EC2 vs Lambda | Whats the difference? Pros and Cons? - YouTube
Lambda Pricing Explained in 5 minutes - YouTube
LinkedIn
linkedin.com › posts › urielbitton_popular-question-what-is-cheaper-to-run-activity-7374785584227196928-sfMd
Lambda vs EC2: Which is cheaper? | Uriel Bitton posted on ...
We cannot provide a description for this page right now
SQLServerCentral
sqlservercentral.com › forums › topic › aws-lambda-provisioned-concurrency-vs-ec2
AWS Lambda provisioned concurrency vs EC2 – SQLServerCentral Forums
May 5, 2022 - If the apps/scripts you are running are under 10 minutes execution then AWS Lambdas would be ideal. I mean, anything really short duration shouldn't be on an EC2 unless there is a security feature you cannot get with AWS Lambda that you need with an EC2. The idea of running VM's is a huge cost, both in time and money.
Amazon Web Services
aws.amazon.com › compute › aws lambda › pricing
AWS Lambda Pricing
1 day ago - You configure your Lambda Managed ... request charges: 100M / 1M × $0.20 = $20 · Compute charges Instance type: m7g.xlarge EC2 on-demand price: $0.1632 per hour (US East N....
Medium
medium.com › @moradiyabhavik › aws-compute-services-lambda-vs-ec2-vs-ecs-choosing-the-most-cost-effective-and-highly-available-1cfb410aff1f
AWS Compute Services: Lambda vs EC2 vs ECS — Choosing the Most Cost-Effective and Highly Available Solution | by Bhavik Moradiya | Medium
June 13, 2024 - Choosing between AWS Lambda, Amazon EC2, and Amazon ECS depends on your specific application requirements, traffic patterns, and operational preferences: AWS Lambda is ideal for event-driven, variable workloads where you want minimal operational overhead and cost-efficiency for intermittent usage.
Stack Overflow
stackoverflow.com › questions › 56274163 › aws-ec2-vs-serverless-cost-comparison
amazon web services - AWS EC2 vs Serverless Cost Comparison - Stack Overflow
So you pay for the compute that is used. This is different to ec2 as ec2 pricing is based on hours ran. So it could be a big savings to go with serverless, but that all depends on the workload you are doing.
Serverless Team
serverless.direct › post › aws-lambda-vs-ec2-which-one-to-choose-for-your-app
AWS Lambda vs. EC2: Which One to Choose for Your App
September 25, 2023 - Since you're only charged when your functions execute, you can avoid the ongoing expenses associated with continuously running servers. Additionally, Lambda's automatic scaling ensures that you don't over-provision resources, further optimizing costs. ... Amazon EC2 offers more flexibility in terms of pricing, with various instance types and pricing options.
Hacker News
news.ycombinator.com › item
AWS Lambda is cool and all, but aren't people doing the math on this? Lambda see... | Hacker News
July 12, 2016 - Am I missing something · Don't compare the cost of Lambda per 100ms to the cost of a virtual machine per month since Lambda only charges as you use it. You'd have to have the CPU pegged at 100% usage to make that a fair comparison. Mind you even if you took the cost of Lambda per 100ms and ...
Sedai
sedai.io › blog › comparing-aws-lambda-eks-ecs-ecs-factors-in-system-design-and-cost-management
Lambda vs EKS vs ECS vs EC2: A Practical Comparison | Sedai
Spot Instances: Discounted pricing ... a t3.micro instance costs around $0.0104 per hour on-demand, whereas larger instances like the m5.2xlarge can cost around $0.384 per hour.In addition to compute costs, remember to factor in additional services such as Elastic Load Balancing (ELB), which can add costs if your EC2 instances need to handle high levels of traffic.EC2 can be the most cost-effective for long-running, predictable workloads, especially when using reserved instances, but it can quickly become expensive for short-lived tasks or fluctuating demand...
AWS
calculator.aws
AWS Pricing Calculator
AWS Pricing Calculator lets you explore AWS services, and create an estimate for the cost of your use cases on AWS.