VxCloud
VxCloud
FastAPI Hosting

FastAPI hosting,
one command to production.

Hand-tuned gunicorn + uvicorn Dockerfile, automatic Let's Encrypt SSL, blue-green deploys, multi-cloud. The same vxcli command works on AWS, GCP, Azure, Alibaba, and Linode.

What vxcloud handles for you (so you can write endpoints)

FastAPI is a pleasure to write and a pain to deploy correctly. The pieces that aren't fun — Dockerfile, worker count, reverse proxy, TLS, health checks, rollback — vxcloud ships with sensible defaults.

Production Dockerfile

Multi-stage build, Python 3.11/3.12 slim, gunicorn -k uvicorn.workers.UvicornWorker, worker count auto-sized to the VM. No Dockerfile in your repo required.

Let's Encrypt automation

Pass `--enable-ssl --domain api.example.com --ssl-email you@…`. Traefik handles ACME via HTTP-01 on :80. Auto-renews on cron. Wildcard via DNS-01 supported on request.

Managed Postgres in one call

`vxcli cloud database create-rds`. Connection string lands in workspace Vault. Reference from the deploy with `--env DATABASE_URL=$(vault:...)`.

Health checks + blue-green

Default health-check probes `/health` (or your `--health-path`). New container goes live only after a 200 response. Old container drains for 30s. One-command rollback.

CI/CD friendly

Same `vxcli deploy fastapi` shape from local laptop or from your GitHub Action / GitLab CI / Jenkins. JSON output mode for parsing in pipeline scripts.

Multi-cloud, multi-region

Switch `--cloud aws` to `--cloud gcp` and you deploy to Google Cloud instead — same command, same defaults. Multi-region = multiple deploys with different `--region`.

Quickstart — FastAPI live with SSL in 3 commands

1) Provision a VMbash
vxcli vm create \
  --name api-vm --cloud aws --region us-east-1 \
  --instance-type t3.small --key-pair-name AWSPRODKEY2

# Capture the public IP for the next step
export API_IP=<paste-public-ip>
2) Provision Postgres (optional)bash
vxcli cloud database create-rds api-db \
  --cloud aws --region us-east-1 \
  --engine postgres --version 16 \
  --instance-type db.t3.micro --storage-size 20 \
  --username appuser --password '<set-strong>'

# Connection string is also stored in workspace Vault automatically.
3) Deploy FastAPI — SSL issued in the same callbash
vxcli deploy fastapi \
  --source-dir ./ \
  --app-name api \
  --entry app.app:app \
  --requirements requirements.txt \
  --app-port 8000 --http-port 80 \
  --env DATABASE_URL=postgres://appuser:...@<rds-endpoint>/api_db \
  --enable-ssl \
  --domain api.example.com \
  --ssl-email [email protected] \
  --host $API_IP --ssh-user ubuntu --key-pair-name AWSPRODKEY2

# https://api.example.com is now live with a valid Let's Encrypt cert.

The same workflow in Python — for CI / automation

vxsdk Pythonpython
import vxsdk
c = vxsdk.Client.load_from_vxcli()

vm = c.cloud.vm.provision(
    name="api-vm", cloud="aws", region="us-east-1",
    instance_type="t3.small", key_pair_name="AWSPRODKEY2",
)

sess = c.deploy.fastapi(
    source_dir="./",
    app_name="api",
    entry="app.app:app",
    requirements="requirements.txt",
    app_port="8000", http_port="80",
    enable_ssl=True,
    domain="api.example.com",
    ssl_email="[email protected]",
    host=vm["public_ip"], ssh_user="ubuntu",
    key_pair_name="AWSPRODKEY2",
)
print(sess["session_id"], sess.get("access_url"))

Production considerations that actually matter

  • Set `WEB_CONCURRENCY` env var if your app blocks the event loop heavily (e.g. heavy CPU-bound endpoints) — overrides the auto-detected worker count.
  • Configure structured logging early. FastAPI + uvicorn default logs are not parseable; ship JSON via `python-json-logger` and forward to OpenTelemetry / Loki.
  • For `/health`, return a fast 200 with no DB calls; for `/ready`, do the DB / dependency check. Health-check failures should not restart pods if the DB is the slow one.
  • Run async DB drivers (asyncpg, aiomysql) — sync drivers inside async endpoints will block the event loop and stall every other request.
  • Set `gunicorn --timeout 60` for endpoints that can legitimately run long (LLM calls, file uploads). The 30s default kills slow but valid requests.
  • Behind the SSL proxy, you receive `X-Forwarded-For` / `X-Forwarded-Proto`. Enable `ProxyHeadersMiddleware` in FastAPI or your audit log shows nginx IP.
  • Watch RAM. Each gunicorn worker forks the model/global state — if you preload a 500 MB ML model in app startup, 4 workers means 2 GB of RAM gone before the first request.

FastAPI hosting FAQ

Deploy your FastAPI app to a real VM today

Free tier covers your first VM, your first managed Postgres, and the first 50 deploys per month.

Related pages