Skip to main content
You can scale Machine memory and CPU settings for entire process groups in apps that are managed by Fly Launch (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

  1. The [[vm]] section in fly.toml: The fly deploy and fly scale count commands respect the VM size configurations in your app’s fly.toml file.
  2. Existing Machine sizes in the app: If no VM size is set in fly.toml, then fly deploy won’t change existing Machines, and fly scale will use existing Machines to infer new Machine sizes.
  3. Default Machine size of shared-cpu-1x: If no VM size is set in fly.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.
These Machines are running at the 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:
If you don’t include a process group in the [[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

Use fly 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 with fly 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.
Check that the app process group has had this scale applied:
You can also confirm that an individual Machine’s config matches this, using fly machine status <machine ID>:
Looks good!

Add RAM

If you are happy with the provisioned CPU resources, but want more memory, then use fly 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.
If you try to set an incompatible CPU/RAM combination through 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.
Here’s an app with two process groups defined:
Say the workers are constantly crunching data and need to be bigger. You can scale a single process group using the --process-group option:
Check the result:

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 using fly machine run or the Machines API), then fly status will warn you of their existence:
The app-wide 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:
If you try to set an incompatible CPU/RAM combination through 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.