# Fly.io CLI
> Deploy and manage apps on Fly.io's global platform

## Summary
Deploy and manage applications on Fly.io's global edge platform. Launch Docker containers, scale across regions, manage secrets and volumes, and connect to managed Postgres — all from the terminal.

## Capabilities
- Deploy Docker containers to Fly.io's global edge network
- Scale applications across multiple geographic regions
- Manage persistent volumes for stateful applications
- Store and inject secrets as environment variables
- Provision and manage Fly Postgres databases
- Open interactive SSH sessions to running machines
- Stream application logs in real time

## When to Use
- Deploying containerized applications close to users globally
- Need a simpler alternative to Kubernetes for container deployment
- Running full-stack apps with databases and persistent storage
- Want geographic distribution without complex infrastructure

## When NOT to Use
- Deploying static frontend sites only (use Vercel or Netlify)
- Need fine-grained infrastructure control (use AWS or GCP)
- Applications locked into another cloud provider's ecosystem

## Key Flags
- `launch`: Create and configure a new Fly.io application from the current directory
- `deploy`: Deploy the application using the Dockerfile or fly.toml config
- `scale`: Scale machine count, size, or memory for the application
- `secrets set`: Set encrypted secrets as environment variables
- `ssh console`: Open an interactive SSH session to a running machine
- `logs`: Stream live application logs

## Usage Patterns
### Launch a new app
```
fly launch
```
Detects the project type, generates fly.toml config, and deploys

### Deploy after changes
```
fly deploy
```
Builds and deploys the application using the existing fly.toml

### Set a secret
```
fly secrets set DATABASE_URL=postgres://user:pass@host/db
```
Stores an encrypted secret and restarts the app to inject it

### Scale to multiple regions
```
fly scale count 3 --region iad,lhr,nrt
```
Runs 3 machines across US East, London, and Tokyo

## Input / Output
- **stdin**: Not typically used
- **stdout**: Deployment status, app info, and log output

## Installation
- **homebrew**: `brew install flyctl`
- **shell**: `curl -L https://fly.io/install.sh | sh`

## Related Tools
- [heroku](/tools/heroku) (alternative): Heroku is a similar PaaS; Fly.io emphasizes edge deployment and Docker
- [docker](/tools/docker) (complementary): flyctl deploys Docker containers; Docker builds the images
- [vercel](/tools/vercel) (complementary): Vercel for frontend, flyctl for backend services

---
Source: https://littlescripts.sh/tools/flyctl
