Skip to main content
Deploy a Next.js application on ECS Fargate behind an Application Load Balancer, or serve a static export from S3 and CloudFront.

Prerequisites

  • A Git repository containing your application and its production build command.
  • A Ravion account with your AWS account connected. Start free at Ravion signup.
  • The Ravion CLI installed and authenticated. See CLI installation.
The examples use my-org/my-app as a placeholder. Replace it with your repository before applying the config.

Set up this Next.js app for Ravion SSR or static hosting.

Open in Cursor

Configure the deployment

Deploy a Next.js App Router or Pages Router application on ECS Fargate behind an Application Load Balancer. Ravion provisions the network and compute resources in your AWS account. This example uses Railpack for the build. Use build_source: dockerfile instead when you need a custom Dockerfile. Set output: "standalone" in next.config.js or next.config.mjs. Next.js writes a self-contained server to .next/standalone/server.js. Copy public and .next/static into the standalone image as described in the Next.js deployment documentation.
ravion.yaml
Set HOSTNAME=0.0.0.0 and use the ECS-provided PORT value in the server environment. The default Next.js server port is 3000.

Static export

For a fully static site, set output: "export" instead. Next.js writes the export to out, which you can serve from S3 and CloudFront.
ravion.yaml
Static export does not run Next.js server features such as API routes, middleware, or server actions. Use public NEXT_PUBLIC_* values for browser configuration.

Apply and connect your domain

Follow custom domains to connect your Application Load Balancer hostname. For static export, connect the CloudFront hostname instead.

Next steps

Custom domains

Point a domain at your deployed service and manage its certificate.

Project config

Preview and apply Ravion configuration from source control.

Pipelines

Add approvals, migrations, and deployment automation.

Logs and metrics

Inspect deploy output and production health in Ravion.