ServiceActive

Fly Machines

Fly.io's API for launching and managing VMs with configurable restart policies.

Open source page ↗

Field note

What it does

Fly Machines are VMs managed via flyctl or the Machines API. Restart policy controls whether flyd restarts a Machine after its main process exits.

Capabilities

Available capabilities

Tags

Tags

Ways to use it

Ways to use it

cli

Not filed / https://fly.io/docs/flyctl/

rest

Not filed / https://fly.io/docs/machines/api-machines-resource/

rest

Not filed / https://fly.io/docs/machines/api/

cli

Not filed / https://fly.io/docs/hands-on/install-flyctl/

rest

Not filed / https://fly.io/docs/reference/machines/

docker

Not filed / Not filed

cli

Not filed / flyctl

rest

Not filed / https://fly.io/docs/machines/api-machines-resource/

cli

Not filed / Not filed

rest

Not filed / https://fly.io/docs/machines/api/volumes-resource/

rest

Not filed / https://fly.io/docs/machines/api/

rest

Not filed / https://fly.io/docs/machines/api/working-with-machines-api/

oauth

Not filed / https://fly.io/docs/reference/openid-connect/

rest

Not filed / https://fly.io/docs/machines/api/

cli

Not filed / https://fly.io/docs/machines/flyctl/fly-machine-run/

rest

Not filed / https://fly.io/docs/machines/api/machines-resource/

openapi

Not filed / https://docs.machines.dev/

rest

Not filed / https://fly.io/docs/machines/api/machines-resource/

Product features

Product features

Allocate an IP address

Allocate an IP to the app for internet access and global routing via Anycast, using flyctl or the GraphQL API.

App configuration files

App configuration (fly.toml)

Set app secrets

Sensitive environment variables can be set on the app; Machines inherit secrets from the app.

Apps resource

API resource for Fly Apps; every Fly Machine belongs to a Fly App.

Certificates resource

Manage SSL/TLS certificates for custom domains.

Check certificate status

Check the validation status of a certificate.

Config file formats

Console command

Cordon and uncordon

Route requests away from or back to a Machine.

Create a Fly App

POST /v1/apps creates an app with a unique name; Machines must be associated with a Fly App.

Custom CPU and memory

Define cpu_kind, cpus, and memory_mb directly in the Machine config.

Delete certificates

Delete a hostname and all certificates, or delete ACME or custom certificates individually.

Delete a Fly App

DELETE /v1/apps/{app_name} deletes an app; Machines should be stopped first, or use ?force=true.

Fast-launching VMs

VMs that can be started and stopped at subsecond speeds.

flyctl commands

Configure, build, and start new Machines with a single command.

flyctl machine commands

Use fly machine run and fly machine update with --vm-size, --vm-cpus, --vm-memory.

Get app details

GET /v1/apps/{app_name} returns app details such as organization slug and name, and checks existence.

Get certificate details

Retrieve details for a certificate by hostname.

How the shutdown sequence works

Import custom certificate

Import your own custom certificate for a hostname.

Internal base URL

http://_api.internal:4280, reachable from the Fly.io private WireGuard network.

kill_signal option

kill_timeout option

List apps in an organization

GET /v1/apps?org_slug= lists apps within an organization.

List certificates

List all certificates for an app with optional hostname filtering and cursor-based pagination.

Region fallback on machine clone

fly machine clone -r "iad,dfw" tries iad first, then falls back to dfw.

Machine lease

Create, get, and release a lease on a Machine.

Machine metadata

Get, add, update, and delete Machine metadata.

Machines API

REST API at api.machines.dev/v1 for programmatic Machine management.

Machines resource

API resource for Fly Machines, the fast-launching VMs.

Machines REST API

A simple and fast REST API for full control over Machines.

Network segmentation

Pass a network argument to place the app on its own IPv6 private network, isolating it from other apps in the org.

OpenAPI spec

OpenAPI 3.0 specification for the Machines API.

fly platform regions

Lists regions where Fly.io has datacenters, with region codes.

Primary region

Process groups

Machines join process groups via fly_platform_version and fly_process_group metadata.

Public base URL

https://api.machines.dev proxies requests to the API from outside the WireGuard mesh.

Request ACME certificate

Add a hostname and request an automatic Let's Encrypt certificate.

always restart policy

Always restart a Machine automatically and never let it enter a stopped state.

no restart policy

Never restart a Machine automatically when its main process exits.

on-fail restart policy

Try up to max_retries (default 10) times within a 5-minute window to restart on non-zero exit.

Runtime options

Size presets

Launch Machines using named presets such as performance-2x.

swap_size_mb option

The app name

Tokens resource

Support for OpenID Connect tokens.

Volume snapshots

List snapshots, create volumes from snapshots, and take on-demand snapshots (beta).

Volumes resource

Create, list, update, delete, and extend Fly Volumes via the Machines API.

Wait for state

Wait for a Machine to reach a specified state.

Ways to get a config file