Skip to the page

Running apps on AWS · mid

Deploying a Next.js app: Vercel vs AWS

Vercel runs every Next.js feature with no setup; on AWS you choose between Amplify Hosting (managed, but officially documented up to Next.js 15 with some features unsupported), OpenNext/SST (Lambda + CloudFront + S3), or a standalone Docker image on ECS behind CloudFront, and each AWS option makes you handle caching, images and environment variables yourself.

The notes

What you must know

  • Vercel: zero config, preview deploys per PR, all Next.js features; cost and vendor lock-in are the trade-offs.
  • Amplify Hosting: managed SSR on AWS; its docs list support up through Next.js 15, and features such as streaming and on-demand ISR are not supported. Check before choosing it for Next.js 16.
  • OpenNext (often deployed with SST): an open-source adapter that maps Next.js output to Lambda, CloudFront and S3.
  • Containers: next.config output: 'standalone' -> Docker image -> ECS Fargate behind an ALB and CloudFront. With several instances, configure a shared cache handler (e.g. Redis) for ISR and 'use cache', and offload image optimisation.
  • Environment variables: NEXT_PUBLIC_* are inlined into the browser bundle at build time; server-only secrets are read at run time from Secrets Manager or Parameter Store.
  • Preview deployments: Vercel and Amplify do them per branch or PR; on ECS you build them yourself (per-PR stacks).

The red pen

Common traps: mistake → fix

  • Mistake: Self-hosting Next.js is just 'npm start' on a server

    Fix: multiple instances need a shared cache, image handling and skew protection.

  • Mistake: Change NEXT_PUBLIC_API_URL in the ECS task definition to point to a new API

    Fix: the value was compiled into the client bundle; rebuild.

Easy to hard

Questions interviewers ask, easy to hard

  1. Where would you deploy a Next.js app and why?
  2. What do you lose leaving Vercel for AWS?
  3. How do environment variables work for Next.js in Docker?
  4. How do you get preview deployments on AWS?

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview