> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloudthinker.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Fly.io

> Connect a Fly.io organization so agents can list apps, check machine state and placement, and audit volumes with a read-only token.

Connect a Fly.io organization so CloudThinker can list your apps, show which machines are started or stopped and where they run, and audit volume size and attachment during an incident or a capacity review. The connection uses a read-only organization token and can't change anything: CloudThinker never sends changes to Fly.io, and Fly.io itself refuses changes made with this token.

***

## Prerequisites

* A Fly.io organization that holds the apps you want to inspect.
* The `flyctl` CLI ([install it](https://fly.io/docs/flyctl/install/)), signed in with `fly auth login` as a member of that organization.
* A CloudThinker workspace where you can add connections.

A read-only token covers one organization. If your apps span several organizations, create one token and one connection per organization.

***

## Setup

**1. Create a read-only organization token**

Run this in your terminal:

```bash theme={null}
fly tokens create readonly --name cloudthinker --expiry 720h
```

`720h` is 30 days. Always pass `--expiry`: Fly.io tokens last 20 years by default. If you belong to more than one organization, add `--org <slug>` to pick the right one. Run `fly orgs list` to see your slugs.

Copy the whole value the command prints, including the `FlyV1 ` prefix (for example `FlyV1 fm2_...`).

Put the expiry date on your calendar. After it, prompts fail with the authentication error under [Troubleshooting](#troubleshooting).

If you lose the token, find its id with `fly tokens list`, revoke it with `fly tokens revoke <token-id>`, and create a new one.

**2. Add the connection in CloudThinker**

In the sidebar, click **More → Workspace settings → Connections**. On the **Builtin Connections** tab, search for **Fly.io**, paste the token into **Access token**, and click **Connect**. CloudThinker lists your organizations with the token to check it.

**Success state:** the Fly.io card shows a **Connected** status.

**3. Run the verify prompt**

Run the [verify prompt](#verify-the-connection) in a new chat.

**Success state:** CloudThinker lists your organizations and their apps.

***

## Connection details

| Field | Environment key | What to enter |
| - | - | - |
| **Access token** | `FLY_ACCESS_TOKEN` | The read-only organization token from `fly tokens create readonly` |

There's no organization slug or region to enter. CloudThinker reads the organization from the token.

***

## Required permissions

The token type is the permission model. `fly tokens create readonly` makes a token that can only read one organization and its resources. It can't deploy, scale, restart, or destroy anything, and Fly.io offers no finer scoping.

> [!WARNING]
>
> Don't use `fly tokens create org` or a personal auth token instead. Both can change your organization, and this connection doesn't need that access.

***

## Agent capabilities

| Capability | What CloudThinker reads |
| - | - |
| **Organizations** | The organizations the token can read, by slug and name |
| **Apps** | Each app's status, owning organization, and deployment state |
| **Machines** | Per app: machine ID, name, state, region, and last update, plus a count per state, how many aren't started, and how many regions are in use out of the regions Fly.io offers (deprecated ones excluded) |
| **Volumes** | Per app: volume ID, name, size, region, state, attachment, and encryption, plus unattached and total provisioned GB |

Every capability is a read, so nothing on this connection asks for approval. Lists show 25 rows by default and say how many they hid. Ask for a wider view (up to 100) when you need it.

This connection can't reach:

| Out of reach | What to do instead |
| - | - |
| Deploys, scaling, machine start or stop, volume changes, secrets | CloudThinker gives you the exact `fly` command to run yourself |
| Logs and application metrics | Connect your log or metrics tool, such as [Grafana](https://docs.cloudthinker.io/guide/connections/grafana.md) or [Datadog](https://docs.cloudthinker.io/guide/connections/datadog.md) |
| Secrets and environment values | Not read, by design |
| Used disk space | Volume size is provisioned capacity, not used space. Check usage inside the machine or in your metrics tool. |
| Cost | CloudThinker reports GB, never a dollar figure. Check billing in the Fly.io dashboard. |

### How to read the results

App status and machine state come from Fly.io's control plane. They aren't health checks.

* A `started` machine doesn't prove your app responds to requests.
* A `stopped` machine isn't a fault. Fly.io stops machines that have autostop configured.
* A stopped machine keeps its volume attached, and Fly.io bills the volume either way. An attached volume isn't proof it's in use, and an unattached volume is worth checking, since you pay for it with no machine to use it.
* An app with no machines was never deployed. It's a reserved name, not a failure.

### Verify the connection

```text theme={null}
Check the Fly.io connection and list my organizations and apps
```

### Example prompts

```text theme={null}
Show my Fly.io apps with their status and deployment state as a table
Which machines in my Fly.io app "api" aren't started, and in which regions?
List unattached Fly.io volumes for my app "api" with total provisioned GB
```

***

## Troubleshooting

> [accordion] Error: You must be authenticated to view this
>
> The token is missing, invalid, or expired. Create a new one with `fly tokens create readonly`. Then open the connection, click the edit icon on the instance, click **Replace…** in **Edit Instance**, paste the token, and click **Save and test**.

> [accordion] Error: Could not find App
>
> The app name is wrong, or the app belongs to an organization this token can't read. Ask CloudThinker to list your apps and use a name from that list.

> [accordion] Insufficient permissions or 403 on a list
>
> The token doesn't cover that resource. Check that you created it for the organization that owns the app and that it hasn't expired.

> [accordion] A section says it's unmeasured
>
> Fly.io refused or couldn't answer that call, so CloudThinker reports a gap instead of a number. Treat the section as unknown, not as zero.

> [accordion] CloudThinker won't deploy, scale, or restart
>
> That's expected. The connection is read-only. Ask for the exact `fly` command and run it yourself.

***

## Security

* **Least privilege** — grant only the permissions the agents need for your use case; start read-only and widen later.
* **Read-only by default** — use read-only credentials unless you want agents to make changes through this connection.
* **Rotate credentials** — rotate keys and tokens on your normal schedule; CloudThinker picks up the new value when you update the connection.
* **Revoke on offboarding** — remove the credential at the provider when you delete a connection or a teammate leaves.

- **Read-only at Fly.io:** the token can't make changes, so a leaked token exposes read access to one organization and nothing more.
- **Short expiry, revoke when done:** list tokens with `fly tokens list` and revoke one with `fly tokens revoke <token-id>` when the work is finished.

***

## Related

> [card] [Render connection](https://docs.cloudthinker.io/guide/connections/render.md)
>
> Connect another app platform, with logs and approval-gated deploys

> [card] [Connections overview](https://docs.cloudthinker.io/guide/connections/overview.md)
>
> See every platform you can connect and how connections work


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.