Step 6
Step 6 — Fly.io one-line deploy
20 min
Step 6 — Fly.io one-line deploy
Fly.io feels like Heroku's successor. Just a Dockerfile, no AWS-shape complexity.
First deploy
curl -L https://fly.io/install.sh | sh
fly auth login
fly launch # interactive setup, generates fly.toml
fly deploy
Done. https://my-app.fly.dev with auto HTTPS.
fly.toml
app = "my-app"
primary_region = "nrt"
[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = "stop"
auto_start_machines = true
min_machines_running = 0
[[vm]]
cpu_kind = "shared"
cpus = 1
memory_mb = 256
auto_stop_machines = "stop" saves money during quiet periods.
Database
fly postgres create --name my-db
fly postgres attach -a my-app my-db
DATABASE_URL is auto-injected.
AWS vs Fly.io
| Aspect | AWS | Fly.io |
|---|---|---|
| Learning curve | steep | flat |
| Time to first deploy | 1+ hour | 5 min |
| Cost (small) | $50+ | $5+ |
| Cost (large) | cheap | pricey |
| Control | full | limited |
Side projects → Fly.io. Real ops → AWS.
Useful commands
fly logs
fly status
fly secrets set KEY=v
fly ssh console
fly scale count 2
Try it
Deploy a small Next.js or FastAPI app. fly apps destroy when done.
Going deeper
Next
Final step 7 — single-server philosophy.