Apps, Machines, regions and volumes
A Fly App is a named group of Machines, and a Machine is one Firecracker microVM that starts in well under a second. Size it with presets, place it in a region, let Fly Proxy stop and start it with traffic, and attach a volume only if you accept the limits.
This page is drawn from https://fly.io/docs/apps/overview/, https://fly.io/docs/machines/overview/, https://fly.io/docs/machines/machine-states/, https://fly.io/docs/machines/cpu-performance/, https://fly.io/docs/launch/autostop-autostart/, https://fly.io/docs/volumes/overview/, https://fly.io/docs/launch/deploy/, https://fly.io/docs/launch/processes/ and https://fly.io/docs/reference/configuration/.
Apps versus Machines
“A Fly App is an abstraction for a group of Fly Machines running your code on Fly.io.” (https://fly.io/docs/apps/overview/) An app holds config, provisioned resources, Anycast IPs, certificates, custom domains, secrets and optional volumes (https://fly.io/docs/apps/overview/). All apps in an organization can talk over a private network (https://fly.io/docs/apps/overview/).
A Machine is “the configuration and state for a single VM running on Fly.io”, and every Machine belongs to an app (https://fly.io/docs/machines/overview/). Application code runs in Firecracker microVMs (https://fly.io/docs/reference/architecture/).
| Question | Answer | Source |
|---|---|---|
| When do you drive Machines directly? | When you need to be picky about “how, where, and when to start VMs” | https://fly.io/docs/machines/overview/ |
| Can one app mix both? | Yes. Machines made with fly machine run are unmanaged and fly deploy does not update them | https://fly.io/docs/launch/deploy/ |
Say: “An app is the unit you deploy and bill against. A Machine is the unit that boots.” Ask: “Do you deploy with fly deploy, or do you create Machines through the API?” The answer decides which scaling commands work (https://fly.io/docs/launch/scale-machine/).
Machine states and lifecycle
Create a Machine and it sits in created while Fly reserves space, fetches the image and builds a root file system, which “can take some time, maybe low double digit seconds”. After that it boots, usually “well under a second” (https://fly.io/docs/machines/overview/).
| Kind | States | Source |
|---|---|---|
| Persistent | created, started, stopped, suspended, failed | https://fly.io/docs/machines/machine-states/ |
| Transient | creating, starting, stopping, restarting, suspending, destroying, launch_failed, updating, replacing | https://fly.io/docs/machines/machine-states/ |
| Terminal | destroyed, replaced, migrated | https://fly.io/docs/machines/machine-states/ |
Support rules of thumb from the docs:
- Stuck Machines.
starting,stopping,restartingordestroyingfor more than 5 minutes, orupdatingfor more than 10 minutes, may be wedged (https://fly.io/docs/machines/machine-states/). - Versions. Every change creates a new Machine version, and an old version queried by ID returns
replacedeven if the Machine is running (https://fly.io/docs/machines/machine-states/).
CPU and memory
Machines come in two CPU kinds, shared and performance. Both run on the same hardware and clock speed; the difference is how much time they may run (https://fly.io/docs/machines/cpu-performance/).
| CPU type | Period | Baseline quota | Burst balance (initial / max) | Source |
|---|---|---|---|---|
shared | 80ms | 5ms (6.25%) | 5s / 500s | https://fly.io/docs/machines/cpu-performance/ |
performance | 80ms | 80ms (100%) | none | https://fly.io/docs/machines/cpu-performance/ |
The page says these numbers might change over time (https://fly.io/docs/machines/cpu-performance/).
Presets and their prices from the pricing page, each for a started Machine (https://fly.io/docs/about/pricing/):
| Preset (source: https://fly.io/docs/about/pricing/) | RAM | Price |
|---|---|---|
shared-cpu-1x | 256MB | $2.19/month |
shared-cpu-1x | 1GB | $6.70/month |
shared-cpu-2x | 2GB | $13.39/month |
performance-1x | 2GB | $33.00/month |
performance-2x | 4GB | $66.00/month |
Rules for custom sizes: valid cpus are 1, 2, 4, 8 or 16 depending on cpu_kind (https://fly.io/docs/reference/configuration/). Maximum memory is 2gb times the shared CPU count or 8gb times the performance CPU count, and minimum memory is 256m per shared CPU or 2048m per performance CPU (https://fly.io/docs/machines/guides-examples/machine-sizing/). Run fly platform vm-sizes for the list (https://fly.io/docs/launch/scale-machine/).
Precedence for sizing: the [[vm]] section in fly.toml wins on fly deploy; otherwise existing Machines are kept; otherwise the default shared-cpu-1x is used (https://fly.io/docs/launch/scale-machine/). If you change size with fly scale vm while [[vm]] is still in fly.toml, the next deploy resets it (https://fly.io/docs/reference/configuration/).
Regions and placement
Fly lists 17 regions in the docs table, from ams to yyz, and fly platform regions shows the live list (https://fly.io/docs/reference/regions/). “Gateway” regions host WireGuard gateways, and “MPG” regions can host Managed Postgres (https://fly.io/docs/reference/regions/). Run fly status to see where your app runs (https://fly.io/docs/reference/regions/).
You choose a region, not a server. If you name a region, the Machine is created only there (https://fly.io/docs/machines/overview/). “Placement can fail!” because a region can run out of capacity, and callers must retry (https://fly.io/docs/machines/overview/). A failed region in a multi-region fly scale count makes the whole operation fail (https://fly.io/docs/machines/guides-examples/machine-placement/). Give fly machine clone a list such as -r "iad,dfw" or an alias such as eu to get fallbacks (https://fly.io/docs/machines/guides-examples/machine-placement/).
Advice: give customers a fallback list, because the docs say sjc and gru tend to be in high demand (https://fly.io/docs/machines/guides-examples/machine-placement/).
Autostop, autostart and min_machines_running
Fly Proxy can stop or suspend Machines when traffic falls and start them when a request arrives (https://fly.io/docs/launch/autostop-autostart/).
| Setting | Meaning | Source |
|---|---|---|
auto_stop_machines | "off", "stop" or "suspend" | https://fly.io/docs/launch/autostop-autostart/ |
auto_start_machines | Start Machines on requests and capacity | https://fly.io/docs/launch/autostop-autostart/ |
min_machines_running | Minimum running Machines, primary region only, needs stop or suspend | https://fly.io/docs/launch/autostop-autostart/ |
[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = "stop"
auto_start_machines = true
min_machines_running = 0
(https://fly.io/docs/launch/autostop-autostart/)
Facts to remember:
- Cold start. About 2 seconds or more for common apps;
"suspend"resumes in a few hundred milliseconds (https://fly.io/docs/launch/autostop-autostart/). - Suspend limits. At most 2 GB of memory, no swap, no schedule, and updated since June 20, 2024 (https://fly.io/docs/reference/suspend-resume/).
- Idle cost. A stopped or suspended Machine is billed only for rootfs at $0.15/GB per 30 days (https://fly.io/docs/launch/autostop-autostart/).
- No creation. Autostop never creates or destroys Machines, so the maximum is the Machines you made (https://fly.io/docs/launch/autostop-autostart/).
- Scale limit. The stop loop runs every few minutes and stops at most one Machine per region per pass, which does not keep up with thousands of Machines in one app (https://fly.io/docs/launch/autostop-autostart/).
Volumes and their limits
“Fly Volumes are local persistent storage for Fly Machines” (https://fly.io/docs/volumes/overview/). Rules that surprise customers:
- One to one. A volume attaches to one Machine, and a Machine mounts one volume (https://fly.io/docs/volumes/overview/).
- One server. “It is not network storage.” (https://fly.io/docs/volumes/overview/)
- One app. A volume cannot be shared between apps (https://fly.io/docs/volumes/overview/).
- No replication. Your app must sync volumes (https://fly.io/docs/volumes/overview/). “Always provision at least two volumes per app.” (https://fly.io/docs/volumes/overview/)
- Size. Default 1GB, maximum 500GB, extend only, never shrink (https://fly.io/docs/volumes/overview/).
- Not at build or release. Volumes are not available during build or in the
release_commandMachine (https://fly.io/docs/volumes/overview/). - Price. $0.15/GB/month on provisioned size, even while detached or on a stopped Machine (https://fly.io/docs/about/pricing/).
Snapshots
Fly takes daily block-level snapshots, keeps them 5 days by default, and retention can be set from 1 to 60 days (https://fly.io/docs/volumes/snapshots/). Snapshots can be created on demand and restored only into a new volume of equal or greater size (https://fly.io/docs/volumes/overview/). Storage is $0.08/GB/month with the first 10GB free (https://fly.io/docs/about/pricing/). Daily snapshots may not have your latest data (https://fly.io/docs/volumes/overview/).
Deploy strategies
Set strategy in [deploy] or pass fly deploy --strategy (https://fly.io/docs/reference/configuration/).
| Strategy | Behavior | Source |
|---|---|---|
rolling (default) | Replace Machines one by one; max_unavailable default 0.33 | https://fly.io/docs/reference/configuration/ |
immediate | Replace all at once without waiting for health checks | https://fly.io/docs/reference/configuration/ |
canary | Boot one new Machine, check health, then roll; not for Machines with volumes | https://fly.io/docs/reference/configuration/ |
bluegreen | Boot a new Machine beside each one; needs a health check; not for volumes | https://fly.io/docs/reference/configuration/ |
Process groups
Define [processes] to run several programs, each in its own Machine(s), scaled separately (https://fly.io/docs/launch/processes/). Without it, Machines belong to the app group (https://fly.io/docs/launch/processes/). “Fly Proxy doesn’t know about process groups”, so give each group its own external port (https://fly.io/docs/launch/processes/).
fly.toml essentials
appandprimary_regionset the name and where new Machines go (https://fly.io/docs/reference/configuration/).[build]picks Dockerfile, image or buildpack (https://fly.io/docs/launch/deploy/).[http_service]or[[services]]expose ports (https://fly.io/docs/reference/configuration/).[[vm]],[mounts]and[deploy]set size, volume and strategy (https://fly.io/docs/reference/configuration/).
What is not possible
- No free tier: new organizations get a $1 trial credit for 7 days (https://fly.io/docs/about/pricing/).
- No choosing a particular server (https://fly.io/docs/machines/overview/).
- No sharing or shrinking volumes, and no automatic volume replication (https://fly.io/docs/volumes/overview/).
min_machines_runningdoes not hold Machines in other regions (https://fly.io/docs/launch/autostop-autostart/).- Fly runs VMs, not containers, even though you ship Docker images (https://fly.io/docs/launch/processes/).
- GPU Machines: the pages above do not settle availability [verify against the current pricing page before promising].