DEV Community

Alex Spinov
Alex Spinov

Posted on

Fly.io Has a Free API: Deploy Apps Globally on Edge Servers

What is Fly.io?

Fly.io runs your applications on servers close to your users worldwide. Unlike traditional cloud that runs in one region, Fly.io deploys your app to 30+ regions simultaneously — giving users sub-50ms latency no matter where they are.

Why Fly.io?

  • Free tier — 3 shared VMs, 160GB outbound bandwidth
  • Global edge — deploy to 30+ regions with one command
  • Firecracker VMs — real VMs, not containers (better isolation)
  • Integrated Postgres — managed PostgreSQL with automatic failover
  • GPU machines — A100 GPUs for ML inference
  • Fly Machines API — programmatically create/manage VMs

Quick Start

# Install flyctl
curl -L https://fly.io/install.sh | sh

# Login
fly auth login

# Launch app (auto-detects Dockerfile, framework)
fly launch
# Deploys globally in ~60 seconds
Enter fullscreen mode Exit fullscreen mode

Fly Machines API

# Create a machine programmatically
curl -X POST "https://api.machines.dev/v1/apps/my-app/machines" \
  -H "Authorization: Bearer FLY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "config": {
      "image": "registry.fly.io/my-app:latest",
      "guest": {"cpu_kind": "shared", "cpus": 1, "memory_mb": 256},
      "services": [{
        "ports": [{"port": 443, "handlers": ["tls", "http"]}],
        "internal_port": 8080,
        "protocol": "tcp"
      }]
    },
    "region": "ams"
  }'
Enter fullscreen mode Exit fullscreen mode

Multi-Region Deployment

# fly.toml
app = "my-global-app"
primary_region = "iad"  # US East

[build]
  dockerfile = "Dockerfile"

[http_service]
  internal_port = 8080
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 1

[[vm]]
  size = "shared-cpu-1x"
  memory = "256mb"
Enter fullscreen mode Exit fullscreen mode
# Scale to multiple regions
fly scale count 2 --region iad,ams,sin,syd
# Now you have VMs in US, Europe, Singapore, and Australia
Enter fullscreen mode Exit fullscreen mode

Managed PostgreSQL

# Create a Postgres cluster
fly postgres create --name my-db --region iad

# Attach to your app (auto-injects DATABASE_URL)
fly postgres attach my-db

# Read replicas in other regions
fly postgres create --name my-db-replica --region ams \
  --initial-cluster-size 1 --replication-source my-db
Enter fullscreen mode Exit fullscreen mode

Fly.io vs Alternatives

Feature Fly.io Railway Render AWS Lambda
Global regions 30+ 1 4 20+
Free tier 3 VMs $5 credit 1 service 1M requests
Isolation Firecracker VM Container Container Microvm
Postgres Managed + replicas Managed Managed RDS (paid)
GPU A100 available No No No
Latency Edge (<50ms) Single region Few regions Cold starts

Real-World Impact

A real-time collaboration app had all servers in US-East. European users experienced 150ms+ latency, making the experience sluggish. After migrating to Fly.io with 6 regions: latency dropped below 40ms globally. User engagement from Europe increased 35%, and the WebSocket connections became noticeably smoother.


Building globally distributed apps? I help teams optimize deployment for edge performance. Contact spinov001@gmail.com or explore my data tools on Apify.

Top comments (0)