How much does it cost to host an API? Serverless vs servers
Hosting an API can cost almost nothing at low volume with serverless, or a predictable monthly amount on a small server, and the crossover depends entirely on request volume. Here is how to estimate API hosting cost and pick the cheaper model.
Quick answer
Hosting an API costs almost nothing at low volume on serverless (Lambda plus API Gateway, where you pay per request and can start in the free tier) or a predictable monthly amount on a small always-on server (an EC2 instance or container, roughly the cost of the instance plus a load balancer). Serverless wins at low or spiky volume; a provisioned server wins at steady high volume. The crossover is about request volume and traffic shape: below a threshold, per-request serverless is cheaper; above it, a continuously-running instance costs less per request. Model both against your real traffic.
The cost of hosting an API depends less on the API itself than on how you run it and how much traffic it gets. Two models dominate: serverless (pay per request, scales to zero) and provisioned servers (pay for capacity that is always on). Each wins in a different regime, so estimating cost means understanding your traffic shape and finding where the two models cross.
The two hosting models
| Model | Pricing | Best for |
|---|---|---|
| Serverless (Lambda + API Gateway) | Per request and compute-ms | Low or spiky volume |
| Container (Fargate / ECS) | Per running task | Medium, steady volume |
| Server (EC2 + load balancer) | Per instance hour + LB | Steady high volume |
Serverless charges per request and per millisecond of compute, so a quiet API costs almost nothing and can run in the free tier, but at high sustained volume the per-request cost adds up. A provisioned server costs the same whether it handles ten requests or ten thousand, so it is wasteful when idle but cheap per request when busy. The Lambda side of this follows Lambda cost in depth.
Serverless: cheap until it is not
For a new or low-traffic API, serverless is usually the cheapest option: no idle cost, pay only for actual requests, and the free tier covers early usage. As volume grows, the per-request and per-millisecond charges accumulate, and at some point a continuously-running instance handling the same load costs less. You can push that crossover further out by using ARM Graviton Lambda, which lowers the per-millisecond rate.
Servers: predictable but always on
A small EC2 instance or container behind a load balancer gives predictable monthly cost: roughly the instance price plus the load balancer fee and its data processing. It does not scale to zero, so at low volume you pay for idle capacity, but at steady high volume it is cheaper per request than serverless and the cost does not spike with traffic. Reserved capacity or savings plans cut the instance cost further for a steady API.
Finding the crossover
| Traffic | Usually cheaper |
|---|---|
| Low / spiky / new | Serverless |
| Medium, steady | Depends, model both |
| High, steady 24/7 | Provisioned server |
The right answer depends on your request volume and how steady it is. A spiky API that is quiet most of the day favors serverless; a busy API with constant load favors a provisioned instance. Model both against your real traffic before committing, and remember that data transfer and any database sit on top of either model, the same components as a broader SaaS backend.
How to keep API hosting cheap
Start serverless while volume is low and uncertain, then reassess as traffic grows and steadies. Use Graviton for both Lambda and any provisioned instances, apply savings plans once you settle on steady capacity, cache responses to cut both compute and requests, and watch data transfer. Measuring cost per thousand requests gives you a unit metric to compare the two models directly and tells you when it is time to switch.
FAQ
How much does it cost to host an API?
It depends on the model and volume. Serverless (Lambda plus API Gateway) costs almost nothing at low volume, since you pay per request and can start in the free tier. A small always-on server (EC2 or a container plus a load balancer) costs a predictable monthly amount regardless of traffic. Serverless wins at low or spiky volume; a provisioned server wins at steady high volume.
Is serverless cheaper than a server for an API?
At low or spiky volume, yes, because serverless scales to zero and you pay only for actual requests, with the free tier covering early usage. At steady high volume, a provisioned server is cheaper per request because it costs the same whether busy or idle and does not accumulate per-request charges. The crossover depends on your request volume and how steady it is.
When should I move from serverless to a server?
When your traffic becomes high and steady enough that the accumulating per-request and per-millisecond serverless charges exceed the cost of a continuously-running instance handling the same load. Measuring cost per thousand requests for both models tells you when the crossover arrives. A spiky, quiet-most-of-the-day API stays cheaper on serverless; a constantly busy one favors a provisioned instance.
What does a serverless API cost at scale?
It grows with volume, since you pay per request and per millisecond of compute. A quiet API costs pennies, but a high-sustained-volume API accumulates real charges. You can push the crossover further out with ARM Graviton Lambda, which lowers the per-millisecond rate, and by caching responses to cut both compute and request counts, but eventually a provisioned server wins on steady high traffic.
What else adds to API hosting cost?
Beyond compute, data transfer out and any database sit on top of either hosting model, the same components as a broader SaaS backend. A load balancer adds a per-LB fee plus data processing for the server model. Caching, right-sizing, Graviton, and savings plans all reduce the compute portion, but transfer and database cost accrue regardless of whether you run serverless or servers.
How does C3X help estimate API hosting cost?
C3X reads your Terraform and prices both models (Lambda and API Gateway, or EC2 or Fargate plus a load balancer) against a live catalog before deploy, so you can compare the recurring cost of each in the pull request. That makes the serverless-versus-server crossover concrete before you commit to an architecture.
What to do next
Compare serverless and server API costs before you commit. C3X reads your Terraform and prices your resources against a live catalog. Start with the quickstart.
Share this post
Try C3X on your own Terraform
Free and open source. No API key required. One command to install, one command to estimate.