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. Answer from re-thc 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
126
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
101
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.
ECR or EFS cost for Lambda
while Lambda's pricing page says that data transfer with EFS and ECR are free, it does also mention it could incur costs in other services. EFS (Elastic throughput) has a read access cost of about $0.03, and ECR has a data transfer out cost of about $0.09 per GB. More on repost.aws
Why we moved from Lambda to ECS
It sounds like your use case could have been addressed by Step Functions - did you look into it before deciding to switch to ECS? More on reddit.com
Is serverless (AWS Lambda) the absolute cheapest option to run cloud native applications?
There's no absolute, always answer. You have to calculate you expected load(s) and plug those into a cost calculator. That will at least get infra cost. Clearly they aren't the same to develop either. More on reddit.com
Using Lambda vs EC2 for a backend
Lambda is much cheaper That isn't true. t3.nano is $0.0052/hour a lambda with the same memory (512 MB) is $0.000000834/ms or $0.05004/hour This makes the cost benefit obvious. If you can keep the server busy for > 6 minutes, an EC2 is cheaper by the hour. (and you can bill by the second with EC2 anyway) Thats a contrived, not red delicious to red delicious comparison, example, but I hope it is illustrative. when utilizing AWS API Gateway API Gateway is expensive once you exceed the free tier. Also, an EC2 has no cold start, and while I recognize cold starts aren't what they get made out to be sometimes, they are still a concern, especially for java solutions. (of course the ec2 has to be already running to not have a cold start, so I guess you could say the cold start on ec2 is way worse) More on reddit.com
12:15
Should I Use Fargate, Lambda, or EC2 to host my application? - YouTube
20:37
Lambda vs Fargate | Lambda Vs EKS Fargate Vs ECS Fargate | Kubernetes ...
16:50
AWS EC2 vs ECS vs Lambda | Which is right for YOU? - YouTube
06:47
Lambda Vs Fargate (EKS) // Lambda Fargate Comparison - YouTube
19:52
AWS EC2 vs Lambda | Whats the difference? Pros and Cons? - YouTube
13:19
AWS Lambda Vs EC2 | Serverless Vs EC2 | EC2 Alternatives - YouTube
Amazon Web Services
aws.amazon.com › compute › aws lambda › pricing
AWS Lambda Pricing
2 weeks ago - Lambda Managed Instances enables you to run Lambda functions on fully-managed EC2 instances in your VPC, combining Lambda's serverless developer experience with the cost efficiency and hardware flexibility of EC2.
AWS
docs.aws.amazon.com › aws decision guides › aws decision guide › aws fargate or aws lambda?
AWS Fargate or AWS Lambda? - AWS Fargate or AWS Lambda?
Reduced operational overhead: Both Lambda and Fargate abstract away server management, reducing the need for patching, maintenance, and capacity planning. Pay-per-use pricing: You only pay for the compute resources you actually use, potentially lowering costs for variable workloads. Faster deployment: Typically offers quicker deployment times compared to provisioning and configuring EC2 ...
CloudZero
cloudzero.com › home › blog › ecs vs. ec2 vs. s3 vs. lambda: the ultimate aws comparison
ECS Vs. EC2 Vs. S3 Vs. Lambda: The Ultimate AWS Comparison
August 29, 2025 - If you switch on an EC2 instance, it runs until you shut down or terminate it. Lambda functions are off by default and are only activated when your setup is called upon (trigger) to serve a request (event). While AWS Lambda can be the more cost-effective option, reactivating Lambda functions every time may lead to latency issues, which EC2 instances do not present — unless you start a new container.
Caylent
caylent.com › blog › cost-optimization-lambda
Cost Optimization: AWS Lambda | Caylent
It could be more beneficial from a business perspective to deploy capital into other business needs rather than allocating current funds toward future compute spend. This savings calculation is complicated even further by the fact that the savings plan will apply to EC2 first, then Fargate second, then Lambda last, because Lambda has the lowest discount rate.
Seft
seft.net
Lambda VS ECS – SEFT – Cloud Consulting Services
With Lambda: Your function is invoked, it runs for a few seconds or minutes, and then it shuts down. You pay only for those brief moments of execution. With ECS (EC2): You’d likely need to keep at least one EC2 instance running 24/7 or have a sophisticated auto-scaling setup that still might incur costs for spin-up time and minimum instances.
LinkedIn
linkedin.com › pulse › comparing-ecs-ec2-lambda-guide-aws-compute-services-neal-k-davis-wplmc
Comparing ECS, EC2, and Lambda: A Guide to AWS ...
We cannot provide a description for this page right now
AWS re:Post
repost.aws › questions › QUwVEJrM0qQvKyy0RTC12SEA › ecr-or-efs-cost-for-lambda
ECR or EFS cost for Lambda | AWS re:Post
January 19, 2024 - while Lambda's pricing page says ... incur costs in other services. EFS (Elastic throughput) has a read access cost of about $0.03, and ECR has a data transfer out cost of about $0.09 per GB....
Sls
sls.guru › blog › serverless-showdown-fargate-vs-lambda
Serverless Showdown: Fargate vs. Lambda | Serverless Guru
May 3, 2021 - Regardless, you’ll still have to use ECS to register your containers since ECS manages Fargate, and this brings additional operational complexity. From all this, you’ll realize that your operational cost options are divided into several choices, including total operational ease via AWS Lambda, complete flexibility provided by EC2, and last but not least, compromising with Fargate.
Dkpathak
blog.dkpathak.in › aws-lambda-vs-ecs
AWS Lambda vs ECS | DKProbes
Lambda manages, provisions, and secures EC2 instances for you, along with providing target groups, load balancing, and auto-scaling. It eliminates the complexity of managing EC2 instances. You want to pay only for capacity used. Lambda charges are metered by milliseconds used and the number of times your code is triggered. Costs are correlated to usage.
Site24x7
site24x7.com › learn › aws › aws-lambda-pricing-optimization.html
AWS Lambda Pricing & Cost Optimization: A Complete Guide - Site24x7
The amount of memory that is allocated to the Lambda function will be a deciding factor for the duration cost. For more detailed pricing according to the memory allocated, refer to this pricing guide. Note that the free-tier pricing is not applicable to Lambdas with Provisioned Concurrency enabled. If you have Provisioned Concurrency enabled, then prices would change as follows: Apart from the above, you may incur data transfer fees for Lambda. The pricing for these will be charged according to AWS EC2 data transfer rates.
Economize
blog.economize.cloud › home › aws › how much does aws fargate really cost? a simple breakdown
How Much Does AWS Fargate Really Cost? A Simple Breakdown
October 3, 2024 - While Lambda offers automatic scaling and resource management, Fargate provides more control over the runtime environment and is suitable for a broader range of applications. AWS Fargate offers a serverless solution for containerized applications, handling all infrastructure management, which makes it ideal for simple, automated scaling and cost-effective for variable workloads. Amazon ECS, however, provides more control and flexibility by allowing you to choose between Fargate’s serverless model or EC2 for custom infrastructure needs.
Softweb Solutions
softwebsolutions.com › resources › aws-lambda-guide
Exploring AWS Lambda: Uses, Security, Performance and Cost
June 25, 2024 - This is particularly effective for applications with sporadic workloads, as Lambda only runs when needed, saving costs on idle server time. Business decision-makers benefit from cost efficiency and flexibility. IoT applications: In IoT ecosystems, Lambda can process data from connected devices ...