Skip to main content
Deploy FastAPI with Uvicorn on ECS Fargate behind an Application Load Balancer.

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 FastAPI app for Ravion ECS hosting.

Open in Cursor

Configure the deployment

FastAPI’s deployment documentation uses an ASGI server rather than a development server. This example uses Railpack for the build. Use build_source: dockerfile instead when you need a custom Dockerfile. Railpack detects FastAPI from the application dependencies. Railpack detects FastAPI when fastapi is a dependency. It starts uvicorn main:app --host 0.0.0.0 --port ${PORT:-8000} when uvicorn is also installed. The default assumes main.py exports app; set a custom start command when your ASGI module uses a different path. Ravion injects PORT automatically from container_port.
ravion.yaml
The default example uses port 8000. Add --workers after validating your memory budget, and use DATABASE_URL for database-backed applications.

Apply and connect your domain

Follow custom domains to connect your domain to the Application Load Balancer.

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.