fly machine commands. For Fly Launch apps, the same general sizing rules apply, but you can also use fly scale commands to update groups of Machines or set a default VM size in the fly.toml configuration file.
General Rules
We have some preset sizes for you to choose from. Each CPU selection defaults to a specific amount of memory. You can, however, scale your machine’s CPU and memory separately. Memory limits are2gb * shared CPU size or 8gb * performance CPU size. Minimum memory is 256m * shared CPU size or 2048m * performance CPU size.
Examples:
- If you have 4 shared CPUs, the max memory you can add is
2048 * 4 = 8192. - If you have 4 performance CPU’s, the max memory you can add is
8192 * 4 = 32768.
Using Size Presets
Any size listed for Machines on the pricing page can be used when creating a Machine. Here’s what that looks like to launch aperformance-2x machine (2 CPU, 4gb memory):
flyctl, the equivalent command looks like this:
Custom Sizes
When creating a machine, you can define the CPU and memory sizes yourself. Memory must be a multiple of 256 for shared sizes, and 2048 for performance sizes. Here we create a machine with a 2 CPUs but double the RAM you’d get if using sizeshared-cpu-2x.
cpu_kind parameter can be one of shared or performance. Learn more about CPU types and performance here.
If you’re using flyctl, the equivalent command looks like this:
shared vs performance. It defaults to shared CPU types.
Adjusting Machine Size
You can adjust CPU and memory by updating a Machine. Updating a machine replaces the VM with a new one, but machine ID stays the same. If we create a machine with the same command as above (using 1024m memory), but later want to reduce that to 512m (the minimum allowed), we can make the following API call:flyctl, the equivalent command looks like this: