Fly.io Deployment Cheat Sheet

Last Updated: November 21, 2025

Installation & Setup

curl -L https://fly.io/install.sh | sh
Install flyctl CLI (Linux/Mac)
brew install flyctl
Install via Homebrew
flyctl auth signup
Create new Fly.io account
flyctl auth login
Log in to existing account
flyctl auth whoami
Show current logged-in user
flyctl version
Show flyctl version

App Creation & Deployment

flyctl launch
Initialize and launch new app
flyctl deploy
Deploy app from current directory
flyctl deploy --remote-only
Build on Fly.io (not locally)
flyctl deploy --strategy rolling
Deploy with rolling update strategy
flyctl deploy --strategy immediate
Deploy all instances immediately
flyctl deploy --dockerfile Dockerfile.prod
Use specific Dockerfile
flyctl status
Show app status and instances
flyctl open
Open app in browser

App Management

flyctl apps list
List all apps
flyctl apps create app-name
Create app without deploying
flyctl apps destroy app-name
Delete app permanently
flyctl apps restart
Restart all instances
flyctl apps move --org new-org
Move app to different organization

Regions & Scaling

flyctl regions list
Show all available regions
flyctl regions add iad ord
Add regions (Virginia, Chicago)
flyctl regions remove iad
Remove region
flyctl regions set fra ams
Set specific regions only
flyctl scale count 3
Scale to 3 instances
flyctl scale count 2 --region iad
Scale specific region
flyctl scale vm shared-cpu-1x
Change VM size (shared 1x CPU)
flyctl scale vm dedicated-cpu-2x
Dedicated 2x CPU
flyctl scale memory 512
Set memory to 512MB

Secrets & Environment

flyctl secrets list
List secret names (not values)
flyctl secrets set KEY=value
Set secret (triggers redeploy)
flyctl secrets set KEY1=val1 KEY2=val2
Set multiple secrets at once
flyctl secrets unset KEY
Remove secret
flyctl secrets import < .env
Import secrets from file
$FLY_APP_NAME
Auto-set app name
$FLY_REGION
Current instance region
$FLY_PUBLIC_IP
Instance public IP

Logs & Monitoring

flyctl logs
Stream application logs
flyctl logs --region iad
Logs from specific region
flyctl monitor
Real-time instance monitoring
flyctl vm status
Show all VM instances
flyctl vm stop instance-id
Stop specific instance
flyctl vm restart instance-id
Restart specific instance

SSH & Console

flyctl ssh console
SSH into running instance
flyctl ssh console --region iad
SSH into specific region
flyctl ssh console --select
Choose instance interactively
flyctl ssh sftp shell
SFTP access to instance

Volumes (Persistent Storage)

flyctl volumes list
List all volumes
flyctl volumes create data --size 10
Create 10GB volume named 'data'
flyctl volumes create data --region iad --size 10
Create volume in specific region
flyctl volumes extend volume-id --size 20
Resize volume to 20GB
flyctl volumes delete volume-id
Delete volume

Databases (Postgres)

flyctl postgres create
Create managed Postgres cluster
flyctl postgres attach postgres-app
Attach database to app (sets DATABASE_URL)
flyctl postgres connect
Connect to Postgres console
flyctl postgres db list
List databases in cluster
flyctl postgres db create dbname
Create new database

fly.toml Configuration

app = "app-name"
App identifier
primary_region = "iad"
Primary region for app
[build] dockerfile = "Dockerfile"
Specify Dockerfile
[env] PORT = "8080"
Environment variables
[[services]] internal_port = 8080
Internal port app listens on
protocol = "tcp"
Service protocol
[[services.ports]] port = 80 handlers = ["http"]
HTTP on port 80
[[services.ports]] port = 443 handlers = ["tls", "http"]
HTTPS on port 443
[mounts] source = "data" destination = "/data"
Mount volume
[[services.http_checks]] path = "/health"
Health check endpoint

Certificates & Domains

flyctl certs create example.com
Add custom domain
flyctl certs list
List all certificates
flyctl certs show example.com
Show certificate details
flyctl certs delete example.com
Remove domain

Best Practices

flyctl deploy --remote-only
Build remotely to save bandwidth
flyctl scale count 2
Run 2+ instances for high availability
flyctl regions add multiple
Deploy to multiple regions for low latency
health checks in fly.toml
Always configure health checks
flyctl volumes create
Use volumes for persistent data
💡 Pro Tip: Fly.io runs apps globally at the edge! Use `flyctl regions add` to deploy to multiple regions. Each instance runs close to users for ultra-low latency!
← Back to Data Science & ML | Browse all categories | View all cheat sheets