fly deploy + fly.toml). If you haven’t defined any process groups, then commands and settings are applied to all the Machines in your app (in the default app process group).
You can scale an app even if it has crashed. Its Machines are restarted with the new specification, however, if you redeploy the app, then any VM settings in
fly.toml take precedence.Machine size configuration precedence
- The
[[vm]]section infly.toml: Thefly deployandfly scale countcommands respect the VM size configurations in your app’sfly.tomlfile. - Existing Machine sizes in the app: If no VM size is set in
fly.toml, thenfly deploywon’t change existing Machines, andfly scalewill use existing Machines to infer new Machine sizes. - Default Machine size of
shared-cpu-1x: If no VM size is set infly.toml, and there are no existing Machines to infer size from, then the default Machine size is used.
Check the VM resources on an app
Here’s a simple web app with three Machines running in different regions: two in Toronto and one in Tokyo. All the app’s Machines belong to the default process group,app, since no other processes exist.
fly scale show shows the CPU and RAM settings for all the Machines deployed using fly deploy under this app.
shared-cpu-1x preset scale, with a single shared vCPU and 256MB RAM.
Add Machine size configuration to fly.toml
With the [[vm]] section in fly.toml, you can set default Machine VM memory and CPU configurations, which take precedence when you run commands like fly deploy or fly scale count.
This example shows a very simple config that specifies the shared-cpu-2x preset with 2GB of RAM:
[[vm]] section, then the settings apply to all process groups in your app. Add another [[vm]] section if you want different CPU or memory settings for specific process groups.
For details and more settings, see The vm section in the fly.toml reference.
Scale VM memory and CPU with flyctl
Usefly scale subcommands to apply VM memory and CPU settings to all Machines: fly scale vm applies a preset CPU/RAM combination; fly scale memory sets RAM separately, for cases when the preset’s RAM is not enough.
Important: If you make changes using
fly scale vm or fly scale memory, the VM settings in fly.toml take precedence when you redeploy the app.Select a preset CPU/RAM combination
There are a number of VM size presets available. See the list of valid named presets withfly platform vm-sizes.
Scale to a different preset using fly scale vm. In general, you should choose a named VM “size” based on your desired CPU type and scale; RAM can be increased separately.
app process group has had this scale applied:
fly machine status <machine ID>:
Add RAM
If you are happy with the provisioned CPU resources, but want more memory, then usefly scale memory to top up the RAM.
If your app crashes with an out-of-memory error, then scale up its RAM. Flyctl restarts the Machines to use the new setting. Scaling memory this way lets you test your app with more or less RAM, before optionally setting memory more permanently in fly.toml.
fly scale memory, flyctl will let you know. There’s a list of allowed CPU/RAM combinations and their prices on our Pricing page.
Scale by process group
Use the--process-group option to specify the process group to scale, with either fly scale vm or fly scale memory.
Note: The
--process-group option is aliased to -g for faster command entry.--process-group option:
Machines not belonging to Fly Launch
If an app has Machines that don’t belong to Fly Launch (in other words, if you created Machines usingfly machine run or the Machines API), then fly status will warn you of their existence:
fly scale commands and any VM settings in fly.toml don’t apply to these Machines, but you can scale any Machine individually with fly machine update:
fly machine update --vm-memory or fly machine update --vm-cpus, flyctl will let you know. Learn more about individual Machine sizing with flyctl and the Machines API.