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 › lambda vs ec2
r/aws on Reddit: Lambda vs EC2
August 29, 2021 -

Say that I have 5000 requests hitting an application every 5 seconds and I need to consume an object and write it to a database. Would a lambda with an http trigger that does an insert be more cost effective than having an ec2 instance that does the same thing?

Edit: Just want to say you all are awesome! I am coming from MSFT world and never experienced so many folks being so helpful. Makes me think I should have switched to AWS ages ago. Thanks everybody.

🌐
TechTarget
techtarget.com › searchcloudcomputing › tip › An-overview-of-Amazon-EC2-vs-AWS-Lambda
An overview of Amazon EC2 vs. AWS Lambda | TechTarget
AWS continues to support and operate the cloud infrastructure and services. With Lambda, AWS handles back-end provisioning, loading, execution, scaling and unloading the user's code.
🌐
CBT Nuggets
cbtnuggets.com › blog › certifications › cloud › aws-lambda-vs-ec2-which-to-use-and-when
AWS Lambda vs EC2: Which to Use and When
EC2 scales out resources when demand increases, and scales in as demand decreases. That way, you are only paying for resources you use, not for the resources you might use. This is the exact same principle as Lambda.
🌐
Sedai
sedai.io › home › 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
March 21, 2026 - Ultimately, the choice between these services boils down to your specific needs: Do you prioritize flexibility and full control (EC2)? Are you looking for simplified container management with serverless scaling (ECS/Fargate)? Or do you need an event-driven, fully serverless solution (Lambda)? EKS, on the other hand, suits those seeking the power of Kubernetes to manage large, distributed applications. Each has its place depending on the architecture of your system and the scale at which you operate. Source: AWS Compute Services: Lambda vs EC2 vs ECS — Choosing the Most Cost-Effective and Highly Available Solution
🌐
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...?

🌐
NAKIVO
nakivo.com › cloud › aws lambda vs. amazon ec2: which one should you choose?
AWS Lambda vs. Amazon EC2: Comprehensive Comparison
April 28, 2026 - When using Infrastructure as a service (IaaS) such as AWS EC2, you can manage operating systems on provided virtual machines (EC2 instances). On the Platform as a Service (PaaS) level, you can run your application that must be compiled before running. When using Function as a Service (FaaS) such as AWS Lambda, you don’t need to compile your application – just insert your code in the interface provided by MSP (managed service provider).
🌐
Medium
medium.com › @repobaby › a-practical-guide-for-when-to-choose-lambda-over-ec2-1173160bd8ec
A practical guide for when to choose Lambda over EC2 | by RepoBaby | Medium
October 1, 2025 - EC2 demands ongoing maintenance: OS updates, patching, and resource monitoring. Lambda abstracts these away, significantly reducing administrative tasks. However, debugging Lambda functions can differ after deployment, relying heavily on logs ...
🌐
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 - By now, you’ve probably noticed that all four AWS services have unique use cases. S3 is AWS’s go-to cloud storage option. EC2 is the computing service that enables applications to run on AWS.
Find elsewhere
🌐
Medium
stephanenoutsa.medium.com › amazon-ec2-instances-or-aws-lambda-functions-10efc1ac9d84
Amazon EC2 Instances or AWS Lambda Functions? | by Stéphane Noutsa | Medium
June 27, 2023 - This kind of workload requires the ability to adjust resources and configurations, which makes EC2 the best option. AWS Lambda, on the other hand, is the perfect candidate when you only need to use computing resources for small units of time.
🌐
PureLogics
purelogics.com › aws-lambda-vs-aws-ec2
AWS Lambda vs AWS EC2: What’s Best for Your Use Case?
December 23, 2024 - EC2 instances are designed for ... even years. In contrast, Lambda functions are ideal for handling specific event-driven responses, as they run only for the duration needed to complete a given task....
🌐
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 - Lambda simplifies coding with event-driven execution, auto-scaling, and pay-per-use pricing. At the same time, EC2 offers customizable virtual servers with flexible workloads and scaling options under a pay-for-usage model.
🌐
Lumigo
lumigo.io › home › aws lambda vs ec2: compared on performance, cost, security, and more
AWS Lambda vs EC2: Compared on Performance, Cost, Security, and More - Lumigo
June 25, 2024 - ALB also needs to be set up to do the load balancing in case multiple instances of applications are installed using multiple EC2 instances. AWS Lambda: In the case of Lambda, you won’t need to worry about the provisioning of VMs, software, scaling, or load balancing.
🌐
Jeevi Academy
jeeviacademy.com › home › blogs › aws › ec2 vs lambda: what’s the difference and when should you use each?
EC2 vs Lambda: What’s the Difference and When Should You Use Each? - Jeevi Academy
February 24, 2026 - The biggest difference: EC2 gives you control. Lambda gives you convenience. Cost is often the deciding factor when choosing between AWS EC2 and AWS Lambda.
🌐
Empowercodes
empowercodes.com › articles › aws-lambda-vs-ec2-which-one-should-you-use-in-2025
AWS Lambda vs EC2: Which One Should You Use in 2025? – EmpowerCodes Technologies
October 30, 2025 - Rule of thumb for 2025: If your application runs 24/7 and uses high compute consistently, EC2 is cheaper. If your traffic varies or usage is low-medium, Lambda is more cost-efficient.
🌐
Dashbird
dashbird.io › home › aws lambda vs ec2: a comparative guide
AWS Lambda / EC2: Which Is Best? | Dashbird
July 25, 2023 - Moreover, if your application requires long-running processes, complex computations, or specific operating system configurations, EC2’s flexibility and control over the computing environment make it a better choice. On the other hand, consider a scenario where you’re building a microservices-based application or a real-time file processing system. In this case, AWS Lambda would be a more suitable choice.
🌐
Perfsys
perfsys.com › blog › guides › aws-lambda-vs-ec2
AWS Compute Comparison: Lambda vs EC2 | Perfsys
EC2 gives you granular control over a virtual machine, while Lambda offers a serverless environment where you focus solely on your code. So, how do you choose? Let’s break it down.
🌐
Intellizu
intellizu.com › articles › aws-lambda-vs-ec2
AWS Lambda vs EC2 | Serverless vs Traditional Compute | Intellizu
November 20, 2025 - Lambda and EC2 represent fundamentally different approaches to running code in AWS. Lambda is serverless—you upload code, AWS runs it when triggered, and you pay per invocation. EC2 provides virtual servers you manage yourself.
🌐
Examlabs
examlabs.com › certification › aws-lambda-vs-amazon-ec2-an-in-depth-comparison
AWS Lambda vs. Amazon EC2: An In-Depth Comparison
Amazon EC2, launched in 2006 as one of AWS’s foundational services, provides virtual machines that give teams complete control over the operating system, runtime environment, networking configuration, and everything that runs on the instance. AWS Lambda, introduced in 2014 as one of the first commercially available serverless compute services, executes individual functions in response to events without requiring teams to provision, configure, or manage any server infrastructure.
🌐
Windframe
windframe.dev › home › blog › aws ec2 vs lambda: which one should you actually use?
AWS EC2 vs Lambda: Which One Should You Actually Use?
December 18, 2025 - Think of it like this: EC2 is renting a computer in the cloud. Lambda is renting tiny slices of computer time only when you need them. That single distinction changes everything about cost, performance, and how you design your apps.
Top answer
1 of 3
11

Based on the discussion in the comments I'm now adding a complete answer to this, as this is not really suitable for a comment.

You mentioned that your current service is already running on EC2 and you'd like to move that over to a Serverless solution. Furthermore you mention the options of "Lambda or Serverless exposed via API-Gateway". Then you add some additional information about expecting a response time of 500ms and the Lambda doing 2 DynamoDB calls.

I'll address these points in order:

EC2 vs Serverless Solution:

You seem to have already decided on trying the Serverless route, which works quite well in principle for a Microservice-Type architecture you're describing. I'm not going to focus too much on the merits of the EC2 solution here. Going serverless can have the following benefits (among others):

  • Cost effectiveness: You pay only for the resources your code consumes while it's running and not for idle times
  • Scalability: Lambda scales horizontally, fast and effortlessly - you basically don't worry about it (up to 1000 parallel "instances")
  • Lower operational overhead: No need to patch operating systems - AWS takes care of that for you
  • Focus on your business logic, leave the heavy lifting of managing the infrastructure to AWS

Lambda or Serverless exposed via API-Gateway

Serverless isn't really an AWS Service but a paradigm or architectural pattern so these options don't completely make sense - you'd use the API Gateway to trigger Lambda functions whenever an Event (read: HTTP-Request) occurs. This means you'll setup a fully-managed REST-Endpoint (API-Gateway) to call your code (Lambda) on demand.

On Performance

A response time of 500ms is realistic for the use case you're describing - DynamoDB advertises single-digit-millisecond latency, so two calls to it within 500ms shouldn't be a problem. Unfortunately Lambda cold-start is a thing. Lambda scales out with parallel requests, meaning a new Micro-VM gets provisioned if there aren't enough warm instances of your function available to serve your request. This takes time, but in your use-case this shouldn't be an issue, since you don't need access to a VPC (in that case it would take multiple seconds).

Lambda is limited in performance compared to EC2 instances, you scale the amount of performance Lambda provides by specifying the amount of RAM the function gets allocated (CPU resources are provided based on the RAM). For a simple Login-Service this shouldn't be an issue as well.

I suggest you read up on the points I mentioned in the Lambda documentation (which is quite good).

2 of 3
0

If you want your events driven service managed use AWS Lambda, you just provide the code in the required language, and Amazon AWS does the rest. If you want to customise for your own needs and use whatever coding language you prefer Amazon EC2 offers flexibility and a whole range of EC2 Instance types to choose from, in conjunction with Elastic Beanstalk services for deploying onto Amazon EC2.

AWS Lambda is a service for running code in response to events, such as changes to data in an Amazon S3 bucket and Amazon DynamoDB tables, or as compute services to run your code in response to HTTP requests using Amazon API gateway or API calls made by using AWS SDKs. This is an ideal computing platform for applications when running within the standard runtime environment.

Lambda should be your best bet.