VPS or serverless. I did the math on a real project.


Every few months the question comes up, usually framed as ideology. This time I ran it as arithmetic, on a real project: a small internal API with a marketing site in front, about fifty thousand requests a month, steady. Three ways to host it, one spreadsheet — and one column nobody prices until the invoice arrives.

The contenders

The arithmetic

50k requests/month, 512MB, ~100ms average

Hetzner CX22                €4.51/mo flat
  traffic                   included (20TB)
  automated backups         +€1.20
                             ------
                             €5.71/mo, known forever

AWS Lambda
  requests   50k × $0.20/M   $0.01
  compute    ~1.4 GB-s       ~$0.25
  API GW     50k × $1/M      $0.05
  DynamoDB   on-demand       ~$0.10
  logs                       ~$0.10
  NAT gateway, if VPC        $0.00 — or $32.40
                             ------
              without NAT    ~$0.50/mo
              with NAT       ~$33/mo

Cloudflare Workers          $0 free tier / $5 paid, 10M req included

Compute is noise at this scale — all three land within rounding distance of free. The bill is decided at the edges: egress and NAT.

The columns without prices

The verdict

Where I landed

The API went to the VPS. It talks to Postgres, and I declined to rent a NAT gateway so my own code could say hello to its own database. The math was never about CPU-seconds — at real-world volumes those are a rounding error on every platform. It is about which edges your architecture forces you to pay for. Choose the shape that keeps the expensive columns at zero, and the ideology debate dissolves into a five-row spreadsheet.