Cloud & Infra
A VPS and a Build Script Beat a Platform Until They Don't
Serving a prerendered file is the easiest workload in computing. Paying a per-request premium for it deserves a second look.
There is a specific moment in a project when a platform is the right answer and a VPS is a distraction, and a later moment when the opposite is true. Most teams never notice the second one. They keep paying platform prices for a workload that a single box and a build script would run for the price of a sandwich.
The arithmetic, naked
A small VPS with a static site on it costs a fixed monthly amount and serves an enormous number of requests, because serving a file is cheap. A managed platform charges for bandwidth, builds, seats or function invocations, and each of those scales with success. Neither is wrong; they scale in different directions.
- Fixed cost — a VPS. Predictable, no surprise invoice, no per-request meter.
- Variable cost — a platform. Cheap at zero, expensive at scale, and wonderful when the traffic is spiky and short-lived.
- Hidden cost — both. On the VPS it is your time: TLS renewal, backups, monitoring, security updates.
For a prerendered site, the origin does almost nothing. A reverse proxy reads a file from disk and returns it. That is the easiest workload in computing to host, and paying a per-request premium for it is a choice worth re-examining once a year.
What you take on with the box
- TLS certificates that renew themselves, and an alert for when they do not.
- A firewall with three open ports, not thirty.
- Backups that are tested by restoring, not by existing.
- An uptime check with an alert that reaches a human.
- A deploy that is one command and can be re-run safely.
That list is not long, and every item is a script you write once. The reason people avoid it is not difficulty; it is that the failure is yours. That is also the reason it is cheap.
The deploy that stays boring
#!/usr/bin/env bash
set -euo pipefail
cd /srv/site
git pull --ff-only
npm ci --omit=dev
npm run build
systemctl reload nginx
curl -fsS https://example.com/ > /dev/null && echo "deployed: $(git rev-parse --short HEAD)"Four properties make that script trustworthy: it fails loudly (`set -e`), it is idempotent, it verifies the result with a real request, and it prints the commit it deployed. Add a lock file and a rollback path (keep the previous build directory) and you have something a platform would charge you monthly for.
Owning the box is not heroic. It is a bill you chose, and a class of failure you agreed to be responsible for.
When the platform wins again
Move back when the traffic is genuinely global and latency-sensitive, when you need preview deployments per pull request, when the team has no appetite for on-call, or when a compliance requirement is cheaper to buy than to build. The mistake is treating the decision as permanent in either direction. Re-evaluate when the workload changes, not when a conference talk makes you feel inadequate.