Fly.io Deep Management
Comprehensive analysis of Fly.io apps, machines, volumes, and global deployment status.
Phase 1: Discovery
#!/bin/bash
TOKEN="${FLY_API_TOKEN}"
BASE="https://api.machines.dev/v1"
AUTH=(-H "Authorization: Bearer ${TOKEN}" -H "Content-Type: application/json")
echo "=== Apps Inventory ==="
flyctl apps list --json 2>/dev/null \
| jq -r '.[] | "\(.Name)\t\(.Organization.Slug)\t\(.Status)\t\(.Deployed)\t\(.Hostname)"' \
| column -t | head -20
echo ""
echo "=== Machines per App ==="
for APP in $(flyctl apps list --json 2>/dev/null | jq -r '.[].Name'); do
curl -s "${BASE}/apps/${APP}/machines" "${AUTH[@]}" \
| jq -r ".[] | \"${APP}\t\(.id)\t\(.state)\t\(.region)\t\(.config.guest.cpus)cpu/\(.config.guest.memory_mb)MB\t\(.config.image | split(\":\") | last)\"" 2>/dev/null
done | column -t | head -30
echo ""
echo "=== Volumes ==="
for APP in $(flyctl apps list --json 2>/dev/null | jq -r '.[].Name'); do
flyctl volumes list --app "$APP" --json 2>/dev/null \
| jq -r ".[] | \"${APP}\t\(.id)\t\(.name)\t\(.region)\t\(.size_gb)GB\t\(.state)\"" 2>/dev/null
done | column -t | head -20
echo ""
echo "=== Certificates ==="
for APP in $(flyctl apps list --json 2>/dev/null | jq -r '.[].Name'); do
flyctl certs list --app "$APP" --json 2>/dev/null \
| jq -r ".[] | \"${APP}\t\(.hostname)\t\(.clientStatus)\t\(.source)\"" 2>/dev/null
done | column -t | head -20
Phase 2: Analysis
#!/bin/bash
TOKEN="${FLY_API_TOKEN}"
BASE="https://api.machines.dev/v1"
AUTH=(-H "Authorization: Bearer ${TOKEN}" -H "Content-Type: application/json")
echo "=== Machine Health Checks ==="
for APP in $(flyctl apps list --json 2>/dev/null | jq -r '.[].Name'); do
for MACHINE in $(curl -s "${BASE}/apps/${APP}/machines" "${AUTH[@]}" | jq -r '.[].id' 2>/dev/null); do
curl -s "${BASE}/apps/${APP}/machines/${MACHINE}" "${AUTH[@]}" \
| jq "{app: \"${APP}\", machine: .id, state: .state, checks: [.checks[]? | {name, status, output: .output[0:50]}]}" 2>/dev/null
done
done | head -30
echo ""
echo "=== Region Distribution ==="
for APP in $(flyctl apps list --json 2>/dev/null | jq -r '.[].Name'); do
echo "--- ${APP} ---"
curl -s "${BASE}/apps/${APP}/machines" "${AUTH[@]}" \
| jq -r '.[].region' 2>/dev/null | sort | uniq -c | sort -rn
done
echo ""
echo "=== Autoscaling Config ==="
for APP in $(flyctl apps list --json 2>/dev/null | jq -r '.[].Name'); do
flyctl autoscale show --app "$APP" --json 2>/dev/null \
| jq "{app: \"${APP}\", min: .MinCount, max: .MaxCount, balanceRegions: .BalanceRegions}" 2>/dev/null
done
echo ""
echo "=== Secrets (names only) ==="
for APP in $(flyctl apps list --json 2>/dev/null | jq -r '.[].Name'); do
SECRETS=$(flyctl secrets list --app "$APP" --json 2>/dev/null | jq -r '.[].Name' 2>/dev/null | tr '\n' ', ')
[ -n "$SECRETS" ] && echo "${APP}: ${SECRETS}"
done
echo ""
echo "=== Resource Summary ==="
for APP in $(flyctl apps list --json 2>/dev/null | jq -r '.[].Name'); do
curl -s "${BASE}/apps/${APP}/machines" "${AUTH[@]}" \
| jq "{app: \"${APP}\", machines: length, total_cpus: [.[].config.guest.cpus] | add, total_memory_mb: [.[].config.guest.memory_mb] | add}" 2>/dev/null
done
Output Format
FLY.IO DEEP ANALYSIS
======================
App Machines Regions CPU/Mem Volumes Status Checks
──────────────────────────────────────────────────────────────────────────────
web-api 3 iad,lhr 2cpu/512MB 0 deployed passing
worker 2 iad 4cpu/1024MB 2x10GB deployed passing
cron-job 1 iad 1cpu/256MB 0 deployed passing
Regions: iad(4) lhr(2) | Total: 6 machines, 10 CPUs, 2.5GB RAM
Certificates: 3 valid | Secrets: 12 across 3 apps
Safety Rules
- Read-only: Only use
flyctl * list, show and GET endpoints
- Never deploy, scale, or destroy machines without explicit confirmation
- Secrets: Never output secret values, only list names
- Rate limits: Fly Machines API has no published rate limit but use reasonable request rates
Anti-Hallucination Rules
- NEVER assume resource names — always discover via CLI/API in Phase 1 before referencing in Phase 2.
- NEVER fabricate metric names or dimensions — verify against the service documentation or
--help output.
- NEVER mix CLI commands between service versions — confirm which version/API you are targeting.
- ALWAYS use the discovery → verify → analyze chain — every resource referenced must have been discovered first.
- ALWAYS handle empty results gracefully — an empty response is valid data, not an error to retry.
Counter-Rationalizations
| Shortcut |
Counter |
Why |
| "I'll skip discovery and check known resources" |
Always run Phase 1 discovery first |
Resource names change, new resources appear — assumed names cause errors |
| "The user only asked for a quick check" |
Follow the full discovery → analysis flow |
Quick checks miss critical issues; structured analysis catches silent failures |
| "Default configuration is probably fine" |
Audit configuration explicitly |
Defaults often leave logging, security, and optimization features disabled |
| "Metrics aren't needed for this" |
Always check relevant metrics when available |
API/CLI responses show current state; metrics reveal trends and intermittent issues |
| "I don't have access to that" |
Try the command and report the actual error |
Assumed permission failures prevent useful investigation; actual errors are informative |
1---2name: managing-fly-io-deep3description: |4 Use when working with Fly Io Deep — deep Fly.io analysis covering app5 inventory, machine status, volume management, autoscaling configuration,6 health check results, certificate status, secrets auditing, and region7 distribution. Use for comprehensive Fly.io platform assessment and8 optimization.9connection_type: fly-io10preload: false11metadata:12 source: https://skillmd.com/skills/cloudthinker-ai/managing-fly-io-deep13---1415# Fly.io Deep Management1617Comprehensive analysis of Fly.io apps, machines, volumes, and global deployment status.1819## Phase 1: Discovery2021```bash22#!/bin/bash23TOKEN="${FLY_API_TOKEN}"24BASE="https://api.machines.dev/v1"25AUTH=(-H "Authorization: Bearer ${TOKEN}" -H "Content-Type: application/json")2627echo "=== Apps Inventory ==="28flyctl apps list --json 2>/dev/null \29 | jq -r '.[] | "\(.Name)\t\(.Organization.Slug)\t\(.Status)\t\(.Deployed)\t\(.Hostname)"' \30 | column -t | head -203132echo ""33echo "=== Machines per App ==="34for APP in $(flyctl apps list --json 2>/dev/null | jq -r '.[].Name'); do35 curl -s "${BASE}/apps/${APP}/machines" "${AUTH[@]}" \36 | jq -r ".[] | \"${APP}\t\(.id)\t\(.state)\t\(.region)\t\(.config.guest.cpus)cpu/\(.config.guest.memory_mb)MB\t\(.config.image | split(\":\") | last)\"" 2>/dev/null37done | column -t | head -303839echo ""40echo "=== Volumes ==="41for APP in $(flyctl apps list --json 2>/dev/null | jq -r '.[].Name'); do42 flyctl volumes list --app "$APP" --json 2>/dev/null \43 | jq -r ".[] | \"${APP}\t\(.id)\t\(.name)\t\(.region)\t\(.size_gb)GB\t\(.state)\"" 2>/dev/null44done | column -t | head -204546echo ""47echo "=== Certificates ==="48for APP in $(flyctl apps list --json 2>/dev/null | jq -r '.[].Name'); do49 flyctl certs list --app "$APP" --json 2>/dev/null \50 | jq -r ".[] | \"${APP}\t\(.hostname)\t\(.clientStatus)\t\(.source)\"" 2>/dev/null51done | column -t | head -2052```5354## Phase 2: Analysis5556```bash57#!/bin/bash58TOKEN="${FLY_API_TOKEN}"59BASE="https://api.machines.dev/v1"60AUTH=(-H "Authorization: Bearer ${TOKEN}" -H "Content-Type: application/json")6162echo "=== Machine Health Checks ==="63for APP in $(flyctl apps list --json 2>/dev/null | jq -r '.[].Name'); do64 for MACHINE in $(curl -s "${BASE}/apps/${APP}/machines" "${AUTH[@]}" | jq -r '.[].id' 2>/dev/null); do65 curl -s "${BASE}/apps/${APP}/machines/${MACHINE}" "${AUTH[@]}" \66 | jq "{app: \"${APP}\", machine: .id, state: .state, checks: [.checks[]? | {name, status, output: .output[0:50]}]}" 2>/dev/null67 done68done | head -306970echo ""71echo "=== Region Distribution ==="72for APP in $(flyctl apps list --json 2>/dev/null | jq -r '.[].Name'); do73 echo "--- ${APP} ---"74 curl -s "${BASE}/apps/${APP}/machines" "${AUTH[@]}" \75 | jq -r '.[].region' 2>/dev/null | sort | uniq -c | sort -rn76done7778echo ""79echo "=== Autoscaling Config ==="80for APP in $(flyctl apps list --json 2>/dev/null | jq -r '.[].Name'); do81 flyctl autoscale show --app "$APP" --json 2>/dev/null \82 | jq "{app: \"${APP}\", min: .MinCount, max: .MaxCount, balanceRegions: .BalanceRegions}" 2>/dev/null83done8485echo ""86echo "=== Secrets (names only) ==="87for APP in $(flyctl apps list --json 2>/dev/null | jq -r '.[].Name'); do88 SECRETS=$(flyctl secrets list --app "$APP" --json 2>/dev/null | jq -r '.[].Name' 2>/dev/null | tr '\n' ', ')89 [ -n "$SECRETS" ] && echo "${APP}: ${SECRETS}"90done9192echo ""93echo "=== Resource Summary ==="94for APP in $(flyctl apps list --json 2>/dev/null | jq -r '.[].Name'); do95 curl -s "${BASE}/apps/${APP}/machines" "${AUTH[@]}" \96 | jq "{app: \"${APP}\", machines: length, total_cpus: [.[].config.guest.cpus] | add, total_memory_mb: [.[].config.guest.memory_mb] | add}" 2>/dev/null97done98```99100## Output Format101102```103FLY.IO DEEP ANALYSIS104======================105App Machines Regions CPU/Mem Volumes Status Checks106──────────────────────────────────────────────────────────────────────────────107web-api 3 iad,lhr 2cpu/512MB 0 deployed passing108worker 2 iad 4cpu/1024MB 2x10GB deployed passing109cron-job 1 iad 1cpu/256MB 0 deployed passing110111Regions: iad(4) lhr(2) | Total: 6 machines, 10 CPUs, 2.5GB RAM112Certificates: 3 valid | Secrets: 12 across 3 apps113```114115## Safety Rules116117- **Read-only**: Only use `flyctl * list`, `show` and GET endpoints118- **Never deploy, scale, or destroy** machines without explicit confirmation119- **Secrets**: Never output secret values, only list names120- **Rate limits**: Fly Machines API has no published rate limit but use reasonable request rates121122## Anti-Hallucination Rules1231241. **NEVER assume resource names** — always discover via CLI/API in Phase 1 before referencing in Phase 2.1252. **NEVER fabricate metric names or dimensions** — verify against the service documentation or `--help` output.1263. **NEVER mix CLI commands between service versions** — confirm which version/API you are targeting.1274. **ALWAYS use the discovery → verify → analyze chain** — every resource referenced must have been discovered first.1285. **ALWAYS handle empty results gracefully** — an empty response is valid data, not an error to retry.129130## Counter-Rationalizations131132| Shortcut | Counter | Why |133|----------|---------|-----|134| "I'll skip discovery and check known resources" | Always run Phase 1 discovery first | Resource names change, new resources appear — assumed names cause errors |135| "The user only asked for a quick check" | Follow the full discovery → analysis flow | Quick checks miss critical issues; structured analysis catches silent failures |136| "Default configuration is probably fine" | Audit configuration explicitly | Defaults often leave logging, security, and optimization features disabled |137| "Metrics aren't needed for this" | Always check relevant metrics when available | API/CLI responses show current state; metrics reveal trends and intermittent issues |138| "I don't have access to that" | Try the command and report the actual error | Assumed permission failures prevent useful investigation; actual errors are informative |139