HomeBlogComparison

Amazon EC2 vs Lambda: 3 Checks Before You Move a Job Off Its Server

A white robot stacks compute, storage and network blocks into a three tier tower in an outdoor cloud engineering lab

Amazon EC2 rents you a virtual server that runs, and bills, whether or not work arrives; AWS Lambda runs your code only when an event calls it and bills per request and per millisecond of memory used. For a business of 10 to 250 people the deciding difference is the shape of the work: short, irregular jobs triggered by uploads, forms or schedules usually cost less and need less upkeep on Lambda, while steady traffic and software that expects a server belong on EC2.

What each service hands you

AWS's Lambda guide calls it a serverless compute service in which AWS manages server maintenance, capacity provisioning, scaling and patching of the underlying infrastructure. EC2 is the opposite arrangement: under the shared responsibility model you manage the guest operating system, its updates and security patches, the application and the security group firewall. That difference in upkeep is often worth more than the difference in the bill.

Check 1: does the job fit Lambda's limits?

As of December 2026, AWS's Lambda quotas page sets these limits for standard functions. Anything outside them stays on EC2 or moves to a container service.

LimitAWS LambdaAmazon EC2
Run time per invocationUp to 30 minutes (longer only for Lambda Managed Instances in some invocation modes)As long as the instance runs
Memory128 MB to 10,240 MB; CPU scales with memory, with one vCPU's worth at 1,769 MBChosen by instance type
Concurrent executions per Region1,000 by default, can be raised; new accounts start lowerWhatever your instances can serve
Request and response size6 MB each for synchronous callsNo service limit
Local temporary storage512 MB to 10,240 MB in /tmpEBS volumes you size
SoftwareYour code in a supported or custom runtimeAny software the operating system can run

A packaged accounting or practice management server does not fit; a script that resizes uploaded images, sends reminder emails or moves files between systems usually does.

Check 2: where does the cost cross over?

The Lambda pricing page lists, as of December 2026, $0.20 per million requests and $0.0000166667 per GB-second for x86 functions in the first tier, with a monthly free tier of one million requests and 400,000 GB-seconds. For comparison, AWS's EC2 On-Demand pricing page lists a t3.medium (2 vCPUs, 4 GiB) at $0.0416 an hour for Linux in US East (N. Virginia), as of December 2026, about $30.37 for a 730-hour month before disk.

Two illustrative workloads, using those prices:

  • Invoice generation. 50,000 runs a month, 20 seconds each, at 2 GB: 2,000,000 GB-seconds, minus the free 400,000, is 1,600,000 billable GB-seconds, about $26.67, and the 50,000 requests fall inside the free tier. Lambda costs slightly less than an always-on t3.medium and leaves no server to patch.
  • A busy internal API. 20 requests a second for a 30-day month, 200 ms each, at 512 MB: about 51.8 million requests and 5.18 million GB-seconds, roughly $79.73 of compute and $10.17 of requests after the free tier. One t3.medium that can serve that load costs about a third as much.

The pattern is general: Lambda wins when the work is idle most of the time and loses when it is busy all the time. Compute Savings Plans apply to both EC2 and Lambda, according to AWS's Savings Plans guide, so a commitment does not lock you into either.

Check 3: who handles failure and recovery?

A failed EC2 instance is your incident: restore from your snapshots, relaunch, and check the application. AWS's Compute SLA commits to 99.5% monthly uptime for a single instance and 99.99% when instances run in two or more Availability Zones, which is why a server that matters should not be a single instance. With Lambda, AWS manages the execution environments, scaling and fault tolerance; your work is retries, error alerts and making each run safe to repeat. In both cases the data the job touches still needs its own backup and a tested restore (see our restore test entry).

When a job should stay on EC2 after all

  • The vendor only supports a server install. Stay on EC2 whatever the traffic shape.
  • The job grows past 30 minutes. Split it into steps or move it to containers on AWS Fargate, which sits between the two; AWS Fargate vs EC2 prices that middle option.
  • Nobody will maintain code. Lambda removes server upkeep but not code upkeep, including runtime version changes.

For other AWS options see Amazon EC2 vs EMR for data processing, AWS Lambda vs Azure Functions for the serverless choice across clouds, and Azure vs AWS for small business if Microsoft's cloud is also on the table. NetSys AWS consulting sorts jobs between servers and functions with the costs worked out; to start with yours, Scope my AWS workload.

More on this topic: AWS operations guides.

Frequently asked questions

Amazon Lambda vs EC2: which is cheaper?

It depends on how busy the work is. With the prices AWS lists as of December 2026, an occasional job of a few seconds costs very little on Lambda, often nothing inside the monthly free tier, while a service that is busy around the clock is usually cheaper on a right-sized EC2 instance.

Can Lambda replace an EC2 web server?

For APIs and small web back ends, often yes, and AWS now offers Lambda Web Functions for Node.js HTTP applications. For packaged software, long-running processes, or anything that needs a full operating system, keep EC2.

What is the maximum run time for Lambda?

As of December 2026, AWS lists a function timeout of 1,800 seconds (30 minutes) for standard functions, with up to 90 minutes for Lambda Managed Instances functions in asynchronous or event source mapping invocations.

Do I still patch anything on Lambda?

Not the servers. AWS patches the underlying infrastructure. You still update your code, its libraries and the runtime version it uses.

Sources

Read on December 2, 2026:

AWS Consulting for Business

Discuss AWS Consulting for Business for your business.

Tell us about your current systems, the result you need and your timeline. We will discuss the work, responsibilities and pricing before you decide on an engagement.

Explore AWS Consulting for Business 845-203-3914