The Machine Runtime Environment
Environment variables make several kinds of information available within a Machine’s runtime environment. The values come from three sources:
- Environment variable settings from the Machine config
- Fly.io infrastructure, as detailed below
App name: Each app running on Fly.io has a unique app name. This identifies the app for the user, and can also identify its Machines on their IPv6 private network, using internal DNS. For example,
syd.$FLY_APP_NAME.internal can refer to the app’s Machines running in the
syd region. Read more about 6PN Naming in the Private Networking docs.
Machine ID: The Machine’s unique ID on the Fly.io platform. This is the ID you use to target the Machine using flyctl and the Machines API. You can also see it in the log messages emitted by the Machine.
Allocation ID: Same as the
Region name: The three-letter name of the region the Machine is running in. Details of current regions are listed in the Regions page. As an example, “ams” is the region name for Amsterdam.
Not to be confused with the HTTP header
Fly-Region, which is where the connection was accepted from.
IPV6 public IP: The full public outbound IPV6 address for this Machine. Read more in the Network Services section.
Docker image reference: The name of the Docker image used to create the Machine.
registry.fly.io/my-app-name:deployment-01H9RK9EYO9PGNBYAKGXSHV0PH is an example of the Docker Image Reference’s format.
Useful if your app needs to launch Machine instances of itself to scale background workers to zero and back, as in Rails Background Jobs with Fly Machines.
Machine configuration version: A version identifier associated with a specific Machine configuration. When you update a Machine’s configuration (including when you update its Docker image), it gets a new
FLY_MACHINE_VERSION. Changing the Machine’s metadata using the metadata endpoint of the Machines API doesn’t trigger a new version. You can also find this value under the name
Instance ID in the output of
fly machine status.
Private IPv6 address: The IPv6 address of the Machine on its 6PN private network.
Process group: The Fly Launch process group associated with the Machine, if any.
Machine memory: The memory allocated to the Machine, in MB. It’s the same value you’ll find under https://fly.io/dashboard/personal/machines and VM Memory in the output of
fly machine status. Learn more about Machine sizing.
Primary region: This is set in your
fly.toml or with the
--region flag during deploys. Learn more about configuring the primary region.