Nov 18, 20268 min read

Vercel vs AWS: Where Should Your Backend Run?

How Vercel Functions, Queues and Marketplace databases compare with ECS, RDS and SQS in your own AWS account for the backend behind a web app, including function limits, BYOC and cost.

Illustration for Vercel vs AWS: Where Should Your Backend Run?

Vercel is where a lot of Next.js apps start, and the reason is simple: a push gives you a preview URL, a CDN in front of every page, and API routes that scale to zero without a server to think about. It starts to hurt when the backend outgrows a request: a job that takes twenty minutes, a worker that should read from a queue all day, or a security review that asks why the customer database sits in a marketplace integration outside the company's AWS account.

AWS has every one of those pieces, in an account you own, along with the networking and IAM work Vercel takes off your plate. This guide compares the two for the backend specifically, and covers the common split where the frontend stays on Vercel and the backend runs in AWS.

Vercel vs AWS at a Glance

EncoreVercelAWS by hand
Backend computeLong-running services on ECS Fargate or EKS in your AWS accountVercel Functions with fluid computeECS, Lambda, App Runner or EC2 in your account
Request durationNo per-request platform cap on the service300 s default, up to 800 s on Pro, 1,800 s in betaLambda 15 min, containers unlimited
PostgresRDS in your account, declared in codeMarketplace integrations such as NeonRDS or Aurora
Queues and workersPub/Sub on SNS and SQSVercel Queues and WorkflowsSQS, SNS, EventBridge
Scheduled jobsCron jobs, managed by the Encore platformCron Jobs, being replaced by SchedulesEventBridge Scheduler
Private networkingServices in a VPC Encore createsSecure Compute, or BYOC on EnterpriseVPC, subnets and security groups you write
Local developmentencore run starts Postgres and queuesvercel dev or the framework dev serverDocker Compose or a dev account

Compute: Functions vs Long-Running Services

Every Vercel API route is a Vercel Function. With fluid compute, an instance can handle several requests at once and stays warm between them, the default maximum duration is 300 seconds, Pro and Enterprise can raise it to 800 seconds, and an extended 30-minute maximum is in beta for some runtimes. That covers most request handlers and many AI streaming responses, and it still means anything longer than the limit has to be split into steps.

On AWS the backend is usually a container service on ECS with Fargate, a process that runs continuously behind a load balancer, or Lambda when per-invocation billing fits. A container has no request duration cap from the platform, can hold WebSocket connections and in-memory caches, and can run a worker loop that reads from a queue for as long as the task is up.

Databases

Vercel no longer runs its own Postgres product. Databases come through the Vercel Marketplace, with providers such as Neon, Supabase and Upstash billed through Vercel, and the database runs in the provider's cloud account. That is quick to set up and fine for many apps, though the data sits outside any AWS account you control.

On AWS, RDS for PostgreSQL runs in private subnets in your VPC, with automated backups, point-in-time recovery and read replicas you configure, and IAM and security groups decide who can connect. Analytics jobs, internal tools and other services in the same account reach it without crossing the public internet.

Background Work and Scheduled Jobs

Vercel now offers Queues for asynchronous work and Workflows for durable multi-step jobs, and its Schedules product, in public beta, is replacing Cron Jobs with time zones, private targets and one-time runs. These run on Vercel's platform and inside the same function model.

AWS has the equivalent primitives as separate services: SQS with dead-letter queues, SNS for fan-out, Step Functions for workflows and EventBridge Scheduler for cron. They are older, widely used and work with anything in your account, and each one needs IAM permissions, consumers and infrastructure code.

Networking, BYOC and Compliance

A Vercel Function on the default network reaches your AWS resources over the public internet. Secure Compute adds a private network with dedicated IPs that can be peered with your VPC, and Bring Your Own Cloud on Enterprise runs Vercel Functions as Lambda functions in your AWS account, while Vercel still terminates TLS, routes requests and serves static assets. With BYOC your team provisions those Lambda functions and owns their IAM roles, network access and quotas.

On AWS directly, everything runs in your VPC from the start, with CloudTrail, IAM and security groups that your security team already reviews.

Cost

Vercel bills a plan per seat plus usage, with function usage measured as active CPU time and provisioned memory under fluid compute, and Marketplace databases billed by their providers. Vercel's pricing page lists current rates. For a frontend with light API routes, the setup stays small.

AWS bills Fargate per vCPU-second and GB-second, RDS per instance hour and storage, and adds load balancers, NAT gateways and data transfer. A backend that is busy most of the day tends to cost less on reserved container capacity than on per-invocation billing, and that saving has to be weighed against the engineering time the AWS setup takes.

How Does Encore Compare to Vercel and AWS?

Encore

Encore works alongside your framework for the backend half of a Vercel app: the API, its database and the queue for slow work are declared together in TypeScript and deployed to your own AWS account, while the frontend stays on Vercel and calls the API over HTTPS. The own cloud docs cover connecting the account.

Set up the backend

Get started
brew install encoredev/tap/encore &&
encore app create
Copy

Run in your terminal to get started locally.

~
$ encore app create reports-api --example=ts/hello-world$ cd reports-api && mkdir -p reports/migrations

The reports folder gets an encore.service.ts exporting new Service("reports") and a migration that creates a reports table with id, account_id, status (default 'queued'), row_count and created_at. A report that takes ten minutes to build would break a function's duration limit if it ran in the request, so the endpoint records it and a subscriber builds it in the background:

// reports/reports.ts import { api, APIError } from "encore.dev/api"; import { SQLDatabase } from "encore.dev/storage/sqldb"; import { Topic, Subscription } from "encore.dev/pubsub"; const db = new SQLDatabase("reports", { migrations: "./migrations" }); interface ReportRequested { reportId: number; } export const reportRequested = new Topic<ReportRequested>("report-requested", { deliveryGuarantee: "at-least-once", }); // Called by the Next.js app on Vercel; returns right away. export const request = api( { expose: true, method: "POST", path: "/reports" }, async (p: { accountId: string }): Promise<{ id: number; status: string }> => { if (!p.accountId) throw APIError.invalidArgument("accountId is required"); const row = await db.queryRow<{ id: number }>` INSERT INTO reports (account_id) VALUES (${p.accountId}) RETURNING id`; await reportRequested.publish({ reportId: row!.id }); return { id: row!.id, status: "queued" }; }, ); export const get = api( { expose: true, method: "GET", path: "/reports/:id" }, async ({ id }: { id: number }): Promise<{ status: string; rowCount: number | null }> => { const r = await db.queryRow<{ status: string; row_count: number | null }>` SELECT status, row_count FROM reports WHERE id = ${id}`; if (!r) throw APIError.notFound("report not found"); return { status: r.status, rowCount: r.row_count }; }, ); const _ = new Subscription(reportRequested, "build-report", { handler: async ({ reportId }) => { // Claim the report so a redelivered message does not build it twice. const claimed = await db.queryRow<{ account_id: string }>` UPDATE reports SET status = 'building' WHERE id = ${reportId} AND status = 'queued' RETURNING account_id`; if (!claimed) return; const rows = await buildReport(claimed.account_id); // runs as long as it needs await db.exec` UPDATE reports SET status = 'done', row_count = ${rows} WHERE id = ${reportId}`; }, ackDeadline: "15m", }); async function buildReport(accountId: string): Promise<number> { // Query, aggregate and write the report somewhere durable. return 0; }
~/reports-api
$ encore run$ curl -X POST localhost:4000/reports -d '{"accountId":"acme"}'{"id": 1, "status": "queued"}

encore run starts Postgres and the topic locally, so the Next.js dev server can call localhost:4000 and the whole flow runs on a laptop. On push, Encore provisions the services on ECS, the RDS database, an SNS topic with an SQS queue and dead-letter queue for the subscription, and the VPC around them, and Encore provisions an IAM role for the service. The subscription's ackDeadline gives the handler fifteen minutes before the message is redelivered, as described in the Pub/Sub docs. An AI coding agent working in this repository adds a new topic or table in the same pull request as the endpoint that uses it, and runs the result locally before anyone reviews it.

The database docs cover migrations, queries and transactions in more detail.

Best fit: Next.js teams that want to keep Vercel for the frontend and run the backend, its database and its workers in their own AWS account.

Vercel for Everything

Keeping the backend on Vercel makes sense when API routes are short, the database works well as a Marketplace integration, and Queues, Workflows and Schedules cover the background work. One platform, one bill and preview deployments for every branch are real advantages for a small team.

Best fit: frontend-heavy apps whose backend logic fits inside request-scoped functions.

AWS by Hand

The by-hand path is ECS on Fargate or Lambda, RDS, SQS and SNS, EventBridge Scheduler and Secrets Manager, joined by IAM roles, security groups and a VPC, usually in Terraform or CDK, with a CI pipeline that builds images and pushes them to ECR. It gives full control and fits teams with platform engineers and existing modules.

Best fit: companies with a platform team that already runs AWS workloads and wants to tune every resource.

How to Choose

Use Vercel alone while the backend is a set of short API routes and the data can live with a Marketplace provider. Move the backend to AWS when you need long-running work, private networking or the database in your own account. Encore is the option for teams that want that backend in their AWS account without writing the infrastructure code for it, with the frontend still on Vercel if they like.

Frequently asked questions

Should I host my backend on Vercel or AWS?

Vercel is a strong fit for the frontend and for request-scoped API routes that finish within the function duration limit. A backend with long-running workers, a database that must sit in your own network, or services that call each other privately is usually better placed in your own AWS account, often with the frontend staying on Vercel.

How long can a Vercel Function run?

With fluid compute, the default maximum duration is 300 seconds on every plan. Pro and Enterprise can raise it to 800 seconds, and an extended maximum of 1,800 seconds is in beta for some Node.js, Bun and Python runtimes, per Vercel's duration docs checked November 18, 2026.

Can Vercel run in my own AWS account?

Yes. On Enterprise plans, Bring Your Own Cloud runs Vercel Functions as AWS Lambda functions in your AWS account, while Vercel still routes requests, terminates TLS and serves static assets. Your team provisions the Lambda functions and owns their IAM roles, networking and quotas.

How do I keep my frontend on Vercel and run the backend on AWS?

Deploy the Next.js app to Vercel as usual and run the API as a separate backend in your AWS account. With Encore, the API, its Postgres database and its queues are declared in TypeScript, encore run starts them locally, and a git push deploys them to ECS, RDS and SNS with SQS in your account, with the frontend calling the backend over HTTPS.

Deploy to your cloud on AWS and Google Cloud
without managing infrastructure

Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.

~/orders — claude
Claude Code
Claude Code v2.1.180Opus 5.5~/orders