The name "serverless" is one of the most misleading terms in technology. There are absolutely servers involved — you just don't manage them. What serverless actually means is that the cloud provider handles all infrastructure provisioning, scaling, and maintenance, while you write and deploy code in small, event-driven functions. You pay only for the compute time you actually use, down to the millisecond.
This model has real advantages for certain workloads and real limitations for others. Let's cut through the marketing and examine when serverless makes sense — and when it doesn't.
How Serverless Works
In a traditional server model (even with cloud hosting), you provision a server, configure it, deploy your application, and pay for the server whether it's handling 10,000 requests or zero. If traffic spikes, you either over-provision (wasting money when idle) or scramble to scale up (risking downtime).
Serverless flips this model:
You deploy functions, not applications. Each function handles a specific task — process a payment, resize an image, send a notification. The cloud provider wraps each function in a lightweight execution environment.
Functions execute on demand. When an event triggers a function (an HTTP request, a database change, a file upload, a scheduled timer), the cloud provider spins up an execution environment, runs your code, and shuts it down. If no events arrive, nothing runs and you pay nothing.
Scaling is automatic. If 100 requests arrive simultaneously, the provider runs 100 instances of your function in parallel. If traffic drops to zero, it scales to zero. You never configure auto-scaling rules or worry about capacity.
You pay per execution. Billing is based on the number of invocations and the duration of each execution, measured in millisecond increments. Idle time costs nothing.
Major Serverless Platforms
AWS Lambda
The market leader, launched in 2014. Lambda supports Node.js, Python, Java, Go, .NET, Ruby, and custom runtimes via container images. It integrates deeply with the entire AWS ecosystem — API Gateway, S3, DynamoDB, SQS, EventBridge, and dozens more services.
Pricing: $0.20 per million invocations + $0.0000166667 per GB-second of compute. The free tier includes 1 million invocations and 400,000 GB-seconds per month — enough for many small to medium workloads.
Google Cloud Functions / Cloud Run
Cloud Functions is Google's equivalent of Lambda for event-driven functions. Cloud Run extends the model to containerized applications — you deploy a Docker container and Google handles the rest. Cloud Run is increasingly the recommended choice because it supports any language or framework that runs in a container.
Pricing: Cloud Functions: $0.40 per million invocations + $0.0000025 per GB-second. Cloud Run: pay per request + compute time with generous free tier.
Azure Functions
Microsoft's serverless offering, with excellent integration with the .NET ecosystem and Azure services. The Consumption plan provides true pay-per-execution pricing; the Premium plan adds features like pre-warmed instances to reduce cold starts.
For a broader comparison of these cloud platforms, see our AWS vs Azure vs Google Cloud guide.
Cloudflare Workers
A different take on serverless — code runs on Cloudflare's edge network (300+ locations worldwide) rather than in a central data center. Workers use the V8 JavaScript engine (the same one that powers Chrome) and start in under 5 milliseconds. Ideal for latency-sensitive workloads and applications that benefit from global distribution.
Pricing: Free tier: 100,000 requests/day. Paid: $5/month for 10 million requests.
When to Use Serverless
Serverless shines in specific scenarios:
Event-Driven Workloads
Processing a file upload (resize an image, scan for malware, extract text). Handling a webhook from a third-party service. Responding to a database change. Running a scheduled job (nightly reports, data cleanup). These are the bread and butter of serverless — discrete, self-contained tasks triggered by events.
APIs with Variable Traffic
A REST or GraphQL API that handles 50 requests per minute during business hours and near-zero at night. With a traditional server, you'd pay for 24 hours. With serverless, you pay for the minutes of actual computation. API Gateway + Lambda (or Cloud Run) is a natural fit.
Microservices
Individual microservices with independent scaling requirements. A notification service might handle bursts of thousands of messages while a user preferences service handles a steady trickle. Serverless lets each service scale independently without managing separate server clusters.
Prototypes and MVPs
When you're validating an idea, serverless lets you go from code to production endpoint in minutes with zero infrastructure setup. The cost at low volumes is negligible (often free-tier), and you can scale up if the idea takes off without re-architecting.
Scheduled Tasks and Background Jobs
Nightly data aggregation, periodic API polling, report generation, data cleanup — these workloads run briefly at fixed intervals. Paying for a server to be idle 23 hours a day while waiting for a 1-hour nightly job is wasteful. A scheduled Lambda function costs fractions of a cent.
When NOT to Use Serverless
Serverless has real limitations that make it a poor fit for some workloads:
Long-Running Processes
AWS Lambda has a 15-minute maximum execution time. Cloud Functions limits to 9 minutes (HTTP-triggered) or 10 minutes (event-triggered). If your task takes 30 minutes — video transcoding, large data processing, ML training — serverless functions aren't suitable without breaking the work into smaller chunks.
High-Throughput, Steady-State Workloads
If your application consistently handles thousands of requests per second, 24/7, a reserved server or container cluster is often cheaper than serverless. The per-invocation pricing advantage disappears when there's no idle time to save on. At high volumes, a dedicated cloud server may cost less.
Latency-Sensitive Applications
Cold starts — the delay when a function hasn't been invoked recently and the provider needs to initialize a new execution environment — can add 100ms to several seconds of latency depending on the runtime and function size. For APIs where every millisecond matters, this variability can be unacceptable. Provisioned concurrency (pre-warmed instances) mitigates this but adds cost.
Complex, Stateful Applications
Serverless functions are stateless by design. Each invocation starts fresh with no memory of previous executions. Applications that require persistent connections (WebSockets), large in-memory caches, or complex stateful logic need additional services (databases, caches, connection managers) that add complexity.
GPU-Intensive Workloads
Mainstream serverless platforms don't offer GPU access. ML inference, video processing, and other GPU-accelerated tasks need container-based or VM-based deployment.
Serverless Architecture Patterns
API Backend
API Gateway + Lambda/Cloud Run for request handling + DynamoDB/Firestore for data storage. This pattern scales from zero to millions of requests with no infrastructure management. It's the most common serverless architecture.
Event Processing Pipeline
S3 upload triggers Lambda for processing → results written to DynamoDB → DynamoDB stream triggers another Lambda for notification. Each stage is independent, scalable, and fault-tolerant.
Scheduled Automation
EventBridge (cron schedule) triggers Lambda to pull data from an API, process it, and store results. No servers running between executions.
Real-Time File Processing
User uploads a file to S3 → Lambda validates and transforms it → result stored in processed bucket → notification sent via SNS. The pipeline handles one file or a thousand concurrently without configuration changes.
The Serverless Ecosystem
Beyond compute functions, "serverless" extends to databases, storage, and other services that follow the same pay-per-use, zero-management model:
Databases: DynamoDB (AWS), Firestore (Google), Cosmos DB (Azure), PlanetScale, Neon (serverless Postgres). These scale automatically and charge based on usage.
Storage: S3 (AWS), Cloud Storage (Google), Blob Storage (Azure). Object storage is inherently serverless — unlimited capacity, pay per GB stored and per request.
Queues: SQS (AWS), Pub/Sub (Google), Service Bus (Azure). Message queues that scale automatically and charge per message.
Authentication: Cognito (AWS), Firebase Auth (Google), Auth0. User management without running auth servers.
Serverless and DevOps
Serverless changes the DevOps equation. There's no server to patch, no OS to update, no scaling rules to configure. But it doesn't eliminate operational concerns — it shifts them:
Observability becomes harder. Distributed, ephemeral functions are harder to trace and debug than monolithic applications. Invest in structured logging, distributed tracing (AWS X-Ray, Datadog), and function-level metrics from day one.
Deployment gets faster. Deploying a function takes seconds. CI/CD pipelines for serverless are simpler because there's no infrastructure to provision — just upload the new code.
Testing requires different approaches. You can't easily replicate the cloud provider's event system locally. Tools like SAM CLI (AWS), Functions Framework (Google), and Serverless Framework help, but integration testing against real cloud services is often necessary.
Vendor lock-in is real. A Lambda function that uses API Gateway, DynamoDB, and SQS is deeply tied to AWS. Migrating to Google Cloud means rewriting integrations, not just redeploying code. Frameworks like the Serverless Framework and SST abstract some of this, but the underlying services differ.
Getting Started
If you want to try serverless without a major commitment:
1. Pick one small, self-contained task in your current system — a scheduled job, a webhook handler, or a simple API endpoint.
2. Implement it as a serverless function on the cloud provider you already use.
3. Deploy it alongside your existing system, not as a replacement.
4. Monitor it for a month — observe cold starts, costs, and operational characteristics.
5. If the experience is positive, identify the next candidate for serverless migration.
Serverless isn't an all-or-nothing decision. Most successful architectures mix serverless functions with traditional services, using each where it makes the most sense. The goal isn't to be "fully serverless" — it's to match each workload to the deployment model that serves it best.