Fly.io
Connect
Connect Fly.io from the terminal. Pass --help for the flags Fly.io accepts, plus --no-browser for headless environments.
polylane cloud connect --provider flyA read-only API token from the Tokens page of your Fly.io dashboard.
Connect your Fly.io organization with one read-only API token. Polylane encrypts the token before it stores it, and the agent never sees it.
- In the Fly.io Dashboard, go to Tokens.
- Create a read-only token. Use the token type with the least access, as described under Token types.
- Copy the token and paste it into Polylane. Polylane checks the token and starts the first sync.
One token connects one Fly.io organization.
Connect Fly.io from a CI job or any other environment without a browser.
Connecting Fly.io needs no browser: the same endpoint the console calls fits in a CI job. One authenticated POST creates the connection and starts the first sync.
Prerequisites
- A Polylane API key with the
cloud_accounts:writeandcloud_accounts:readscopes. See API keys and OAuth. - Your workspace ID, which starts with
ws_. Read it fromGET /v1/workspaceswith the same key. - A Fly.io read-only API token, created under Tokens in the Fly.io dashboard.
Create the connection
curl -X POST https://api.polylane.com/v1/cloud_accounts \
-H "x-api-key: $POLYLANE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"provider": "fly",
"workspaceId": "ws_0abc123",
"token": "<fly-api-token>"
}'
The token resolves to one Fly.io organization, so one call connects one organization.
- Organization discovery reads the apps the token can see, so a token that reaches no apps fails with a
400.
The response lists what was connected, with the first sync already running. Trimmed to the two fields the rest of the flow reads:
{
"success": true,
"result": {
"provider": "fly",
"accounts": [{ "id": "acc_34gky74ibc92h8t2efn8csrh", "status": "syncing" }],
"failures": []
}
}
An account that is already connected lands in failures instead of accounts, so repeating the call never duplicates a connection.
Wait for the first sync
Poll each returned account by its id until status reaches ready (new on registration, syncing while resources stream in):
until [ "$(curl -s "https://api.polylane.com/v1/cloud_accounts/$WORKSPACE_ID/$ACCOUNT_ID" \
-H "x-api-key: $POLYLANE_API_KEY" | jq -r '.result.status')" = "ready" ]; do
sleep 15
done
Give the loop a deadline so a failed connect fails the job instead of hanging it. Once the account is ready, its resources are in the topology and Polylane has started its first check.
Disconnect from the API
Deleting the connection stops every sync and check and deletes the credentials Polylane held. The call needs the cloud_accounts:delete scope:
curl -X DELETE "https://api.polylane.com/v1/cloud_accounts/$WORKSPACE_ID/$ACCOUNT_ID" \
-H "x-api-key: $POLYLANE_API_KEY"
Then revoke the Fly.io token, as described under Disconnecting.
How it works
Resources in the context graph
Polylane maps your apps, machines, volumes, certificates and app secrets. For a secret, Polylane stores the name only. Polylane syncs every 15 minutes.
When a sync finds machines of an app on a new image, Polylane records a deployment for that app, with the machines and regions that changed.
Checks and anomaly detection
An account check counts the machines that are stopped, failed or being destroyed across all apps in the organization.
Each app and machine also gets its own monitor. Polylane reads HTTP requests, the 5xx error rate, responses by status code, CPU and memory from the Fly.io Prometheus API, and the recent logs. Each volume reports its storage use. Polylane compares each series with its usual level, and opens an issue when a change is a real problem.
Fly.io has no API for historical logs. Polylane reads only the recent log buffer that Fly.io keeps, so a log read can cover part of the time window only.
What agents can do
During an investigation, agents read app metrics, recent logs, machines with their image, region and update time, and the release history of an app. Agents can call other Fly.io Machines API endpoints to read more, and can set a watch that wakes a thread when the next deployment of an app lands.
A read-only token cannot change anything in Fly.io. With a token that can write, agents can request changes through the Machines API. The account is read-only in Polylane by default, and each change needs safety review and approval before it runs.
Token types
| Type | Access | Recommended |
|---|---|---|
| Read-only | Reads resources only | Use this |
| Deploy | Can deploy apps | Not necessary |
| Personal | Full account access | Not recommended |
Disconnecting
Disconnecting does not change Fly.io. Revoke the token under Tokens in your Fly.io dashboard.
Disconnect
Disconnecting stops every sync and check and deletes the credentials Polylane held. Everything Polylane set up in Fly.io is removed as well; nothing is left behind.
polylane cloud disconnect <id>Tools
4Operations agents can perform in threads.
Supported resources
5Resource types that show up in your infrastructure graph.