The cloud computing market is now a half-trillion-dollar beast, and serverless is its loudest siren call. But before you ride that wave, consider this: AWS Lambda's free tier dangles one million requests and 400,000 GB-seconds per month (AWS Lambda Pricing). That sounds generous, but it's a tease—designed to get you hooked before the meter starts running. As working practitioners, we've seen too many teams dive into serverless without understanding the real economics. So let's answer one specific question: Is serverless actually cheaper for your workload, or are you just trading one bill for another?
What Serverless Really Charges You For
Serverless isn't a single product; it's a pricing model that shifts costs from idle time to actual execution. AWS Lambda charges $0.20 per million requests and $0.0000166667 per GB-second beyond the free tier (AWS Lambda Pricing). Azure Functions follows a similar pattern with a monthly free grant of one million requests and 400,000 GB-seconds, then bills per-second resource consumption (Azure Functions Pricing). Google Cloud Functions gives you 2 million invocations, 200,000 GHz-seconds, and 400,000 GB-seconds free, then charges $0.40 per million invocations, $0.0000100 per GHz-second, and $0.0000025 per GB-second (Google Cloud Functions Pricing). These numbers look tiny, but they add up fast when you have a high-traffic API or a data pipeline that runs continuously.
The Hidden Costs: Memory, Duration, and Cold Starts
Here's where most people get blindsided: you're not just paying for compute time; you're paying for memory allocated during that time. Lambda lets you set memory from 128 MB to 10,240 MB in 1 MB increments (AWS Lambda Pricing). The more memory you allocate, the more you pay per GB-second. And if your function runs for 500 ms instead of 100 ms, you're billed for the full duration—no rounding down. Azure Functions rounds memory up to the nearest 128 MB, with a maximum of 1,536 MB, and the minimum execution time is 100 ms (Azure Functions Pricing). That means a function that runs for 10 ms still costs you 100 ms. Cold starts add latency, but they don't directly cost money, yet they can push your duration over thresholds, increasing your bill.
When Serverless Is a No-Brainer: Spiky, Low-Traffic Workloads
If your workload is spiky and low-traffic—say, a webhook that fires a few hundred times a day or a cron job that runs hourly—serverless is often the cheapest option. You pay only for the milliseconds you use, and the free tier covers a lot. For instance, a Lambda function running 1 million requests per month with 128 MB memory and 200 ms duration would use 200,000 GB-seconds, well within the free tier (AWS Lambda Pricing). You'd pay $0 for compute. Compare that to an always-on EC2 t3.micro at $0.0104/hour (AWS EC2 Price List API), which costs about $7.50/month even if you use it for only 10 minutes a day. Serverless wins hands down for such workloads.
When Serverless Becomes a Money Pit: Steady, High-Throughput Services
But the moment your workload becomes steady and high-throughput—like a production API serving thousands of requests per second—serverless pricing can spiral out of control. Let's run the numbers. Suppose you have 10 million requests per month, each requiring 1 GB memory and 500 ms duration. That's 5 million GB-seconds per month. On Lambda, beyond the free tier, that's roughly $83 for the GB-seconds and $2 for the requests (AWS Lambda Pricing). That's $85/month. Now compare that to a dedicated EC2 instance: a t3.medium (2 vCPU, 4 GiB) costs $0.0416/hour (AWS EC2 Price List API), or about $30/month. You could run that instance 24/7 for less than the Lambda bill, and you'd have more predictable performance. And if you need more power, a Graviton-based m7g.large at $0.0816/hour (AWS EC2 Price List API) is still cheaper than the Lambda equivalent for sustained load.
The Middle Ground: Fargate and Container-Based Serverless
If you like the idea of not managing servers but want more control over cost, AWS Fargate is a sweet spot. It's a serverless compute engine for containers that scales up to 16 vCPU and 120 GB of memory per task (AWS Fargate). You pay for the vCPU and memory you reserve, not per request, which can be more predictable for steady workloads. For example, a Fargate task with 0.5 vCPU and 1 GB memory running continuously would cost roughly $25/month (using Lambda-like pricing, but Fargate's actual rates differ). That's competitive with EC2 but without the server management. Similarly, Azure Container Apps offers an always-free tier of 180,000 vCPU-seconds, 360,000 GiB-seconds, and 2 million requests per month (Azure Free Account)—a generous starting point for containerized microservices.
Our Recommendation: Match the Model to the Workload
Stop thinking serverless vs. servers as a binary. Instead, ask: Is this workload spiky and low-volume? Then serverless functions are a steal. Is it steady and high-volume? Then a reserved or savings-plan-backed EC2 instance will be far cheaper. The fact base shows that AWS Savings Plans can cut costs by up to 66% (AWS Documentation), and Graviton instances cost up to 20% less than x86 (AWS Graviton)—those savings dwarf any serverless convenience for sustained load. For containerized apps that need scaling, Fargate or Azure Container Apps give you serverless benefits without per-request pricing pitfalls.
Bottom Line
Serverless is a tool, not a religion. For spiky, low-traffic workloads, embrace it—the free tiers are generous. For steady, high-throughput services, run the numbers before you commit. In most cases, a well-chosen EC2 or Fargate setup with a Savings Plan will beat Lambda on cost. Don't let the pay-per-use illusion blind you to the math.
Sources
- AWS Lambda Pricing - https://aws.amazon.com/lambda/pricing/
- Azure Functions Pricing - https://azure.microsoft.com/en-us/pricing/details/functions/
- Google Cloud Functions Pricing - https://www.srvrlss.io/provider/google-cloud-functions/
- AWS EC2 Price List API - https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/us-east-1/index.json
- AWS Fargate - https://aws.amazon.com/fargate/
- Azure Free Account - https://azure.microsoft.com/en-us/free/
Comments (0)
Please sign in to post a comment.
Don't have an account? Create one
No comments yet. Be the first to comment!