DeploysA self-hosted Vercel alternative on AWS
I started building Deploys because my Vercel bill was insanely high. The plan was $20 a month, but I was always hitting the usage limits, so I was really paying $60 to $80. And the billing was a mess. It was really hard to tell what I was actually going to pay.
I'd always known Vercel was a layer on top of AWS. I even knew the outline: you push, the site gets built into files, the files go to S3, and CloudFront serves them. Knowing the outline and building it are two different things, though. Before coding agents, I don't think I could have figured out everything in between.
So I built my own. Now I pay AWS's raw usage price, and every deployment shows exactly what it cost. I wrote about replacing paid software with my own in The SaaS Chopping Block.


The dashboard. There’s also a CLI, an HTTP API, and an MCP server, so coding agents can deploy, read build logs, and roll back too.
How a Git Push Becomes a Live URL
The outline was the easy part: build it, put the files in S3, serve them from CloudFront. This is everything in between. Drag the diagram to look around.
Drawing the diagram…
01
Webhook
API Gateway → Lambda
Verifies the GitHub signature and records the deployment in DynamoDB. Skips are decided here, before any machine starts: a paused project, a push that touches nothing under the project’s root, or a commit that is already deployed. Everything else starts a Step Functions execution.
02
Prepare
Lambda
Mints a GitHub installation token, gathers environment variables and scoped STS credentials, and sets the commit’s GitHub status to building.
03
Dispatch
SQS + DynamoDB
Puts an offer on a queue for the build VM. Ownership is a compare-and-swap on the deployment’s runner field. If nothing claims it in 5 seconds, an Arm Fargate task (2 vCPU, 8 GB) runs it instead.
04
Build
Build VM or Fargate
One builder image on both. It clones at the commit, restores node_modules and .next/cache from the build cache, runs next build with standalone output, and zips the server with a small bridge for Lambda. Then it ends its own Step Functions task instead of waiting for the container to stop.
05
Publish
Lambda + S3
Uploads only the static files no earlier deployment has. Publishes a version of the project’s function, guarded by its code hash, and an alias named after the deployment with a streaming function URL. Env vars past Lambda’s 4 KB limit are sealed with AES-256-GCM. Then it warms the alias and sends a first request.
06
Route
CloudFront Function
Every route change goes out in one batched KeyValueStore write. On each request, the function reads the entry for the host: static paths go to S3, everything else to the deployment’s function URL with a shared secret header.
$ git push origin main
A real build from November 27, from push to live in 34 seconds, replayed about five times faster.
Architecture Decisions
Next.js’s Own Server
over OpenNext
Deploys runs Next’s standalone server inside Lambda behind a small bridge, so anything next start supports just works. ISR is shared across instances through a custom cache handler.
One Function per Project
over A Function per Deploy
Each deployment is a version of the project’s function, with its own alias. Old deployments run exactly what they were built with. Production isn’t an alias at all. It’s a route.
A CloudFront Function
over Lambda@Edge
A key lookup at the edge, with no origin call and no database in the way. Promoting, rolling back, and splitting traffic between two deployments are all one key change.
A Dedicated Build VM
over Fargate for Everything
Fargate takes about 25 seconds to start. An Arm VM on Oracle Cloud starts in under one, with the cache on its own disk. A compare-and-swap and heartbeats make sure nothing builds twice.
A Shared Secret
over Origin Access Control
OAC needs the browser to hash every POST body. HTML forms and Next.js server actions don’t, so every form on every site would break.
Time-Ordered IDs
over A Route Write per Push
IDs are UUIDv7, so the edge can tell a deployment is under 45 minutes old and show “Deploying” instead of a 404. That skips a $0.002 write on every push, which is the biggest part of what a push costs.
Instant Rollbacks, With Nothing Rebuilt
Production is just a route at the edge. Promoting or rolling back changes one key, and nothing is rebuilt.
Old deployments keep their files and their function versions, so any of them can come back. Try it on a real site’s history.
- Install @prestonkwei/icons from GitHub Packagesdpl_01a21f44 · 52e0934 · built in 33s
- Rename the package to @prestonkwei/codes and serve Rings imagesdpl_01a21ee5 · 61f0def · built in 39s
- State Rings damage figures as a side-by-side comparisondpl_01a21ee2 · 1cc2a93 · built in 34s
- Add Rings, a second code format, alongside Stitchdpl_01a21ee1 · 0a09867 · built in 35s
KeyValueStore
codes.deploy.pkwei.xyz → dpl_01a21f44
Pick an older deployment to roll back to.
What Broke
Early on, deployments took forever, and sometimes a finished deployment never showed up on the production URL. That was ironic, since speed was the reason I used Vercel in the first place.
The router is the one piece that can take every site down at once. It has, twice. Both times, a new version answered 503 on every request, because CloudFront’s runtime rejects an await nested inside another call.
Now every await sits on its own line, and a test fails the build if one doesn’t. Each new router runs against real CloudFront before it goes out, and the deploy stops if it errors or uses more than 70% of its CPU budget.
Took every site down
const entry = JSON.parse(await kvs.get(host))
What it does now
const raw = await kvs.get(host) const entry = JSON.parse(raw)
Simplified from the real router.
What It Costs to Self-Host on AWS
Every deployment is priced from the AWS Price List, which Deploys pulls once a day, so the dashboard shows what each one actually cost.
A push costs about $0.0032 on the build VM, or $0.0048 when it falls back to Fargate, plus $0.52 a month that doesn’t move. Traffic is extra, about $1.53 per million Next.js requests, and the free tier covers the first few million.
AWS bill for the month
$0.84
- Builds
- $0.32
- DNS zone and image registry
- $0.52
Limitations
Middleware at the Edge
Server functions run in one AWS region, so middleware runs there too.
WebSockets
Not supported, and neither is work after the response is sent.
Warm Previews
Production is pinged every five minutes. Previews still start cold.
Other Frameworks
Next.js is the only one that runs as a server. Everything else deploys as static files.
Smarter Rollouts
Traffic can be split between two deployments, but there are no automatic steps or rollback on errors.
Questions
- Can Next.js run on AWS Lambda without OpenNext?
- Yes. Deploys builds with Next.js’s standalone output and runs that server inside Lambda behind a small bridge, so anything next start supports works, including middleware, server actions, ISR, and next/image. ISR is shared across instances through a custom cache handler backed by S3 and DynamoDB.
- How much does it cost to self-host a Vercel alternative on AWS?
- About $0.0032 a push when the build runs on the build VM, or $0.0048 when it falls back to Fargate, plus $0.52 a month for the DNS zone and image registry. A hundred pushes come to about a dollar. Traffic adds about $1.53 per million Next.js requests, and the AWS free tier covers the first few million.
- How do instant rollbacks work?
- Each deployment is its own Lambda version and alias, with its own files in S3. Production is a hostname key in CloudFront KeyValueStore that points at one deployment, so rolling back rewrites that key. Nothing is rebuilt.
- Does it work with existing Vercel projects?
- It has an import flow that checks compatibility, copies environment variables, runs a test deploy, and moves domains one at a time without downtime. vercel.json keeps working as it is, and cron routes written for Vercel run unchanged.
Built by Preston Kwei with AWS Lambda, CloudFront, Step Functions, ECS Fargate, DynamoDB, S3, Next.js, and TypeScript.





