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

# fjall reconnect

> Restore OIDC trust for a disconnected AWS account in place with the Fjall CLI, without re-tiering or renaming it.

<Accordion title="Prerequisites">
  * Fjall CLI installed, Node.js 22 or later.
  * Signed in. Run `fjall login`, or set `FJALL_API_KEY` for CI. Credentials live at `~/.fjall/auth.json` (or `$FJALL_CONFIG_DIR/auth.json`).
  * At least one AWS account in your organisation with status `disconnected`. Run `fjall connect status` to see every connection, disconnected ones included.
  * Permission to create a CloudFormation stack in the target AWS account. The command opens the AWS console in your browser.
</Accordion>

## Restore a disconnected account

```bash theme={null}
fjall reconnect [awsAccountId]
```

Reconnect the only disconnected account. The CLI auto-selects it and prints which account it picked.

```bash theme={null}
fjall reconnect
```

Reconnect a specific account by its 12-digit AWS account id.

```bash theme={null}
fjall reconnect 123456789012
```

Reconnect with extra step detail.

```bash theme={null}
fjall reconnect 123456789012 --verbose
```

<Note>
  `fjall reconnect` restores an account whose status is `disconnected`. `fjall connect --force` does something different: it re-issues a fresh CloudFormation stack for a connection that already matches on region and environment. Use `fjall connect` for a brand-new account, `fjall reconnect` to recover an existing one.
</Note>

## What happens

The command runs four steps and prints progress for each.

| Step                           | What it does                                                                              |
| ------------------------------ | ----------------------------------------------------------------------------------------- |
| Resolving disconnected account | Picks the target account from the argument, or auto-selects the sole disconnected account |
| Opening AWS CloudFormation     | Requests a Quick Create URL from the Fjall API and opens it in your default browser       |
| Waiting for CloudFormation     | Polls for the stack to finish, up to 12 minutes, printing elapsed time                    |
| Validating OIDC connection     | Confirms the restored role can be assumed                                                 |

Key behaviours:

* **The existing record is preserved.** Reconnect is OIDC-only. The account's name, tier and stage stay exactly as they were, so recovering from a connector teardown does not re-tier or rename anything.
* **The browser opens automatically.** The Quick Create URL is also printed as `Open in browser: <url>`, so you can open it by hand if the automatic launch fails.
* **Already-connected accounts short-circuit.** If OIDC trust turns out to be intact, the CLI reports that, marks every step complete and exits without creating a stack.
* **Validation failure is not fatal.** If the role cannot be validated straight after the stack completes, the CLI warns that the connection was re-established but validation failed, and suggests waiting a moment before retrying.
* **Account-tier connections get a deploy hint.** After a restored `account`-tier connection, the CLI probes whether that account's infrastructure stack is deployed and points at `fjall account deploy` to deploy or update it.
* **Cancelling is safe.** Ctrl+C reports `Reconnect cancelled by user` and runs signal cleanup.

### Target resolution

| Input                                   | Result                                                       |
| --------------------------------------- | ------------------------------------------------------------ |
| A valid 12-digit id                     | That account is reconnected                                  |
| A malformed id                          | Fails with an invalid-account-id error before any AWS call   |
| No id, exactly one disconnected account | That account is auto-selected and named in the output        |
| No id, no disconnected accounts         | Fails and points you at `fjall connect` to add a new account |
| No id, several disconnected accounts    | Lists them and asks you to re-run with an explicit id        |

### Output

On success the CLI prints a summary carrying the account id, the resulting status, and the region when one is resolved. On failure it marks the active step as errored and prints the masked failure message.

### Agent mode

`fjall reconnect` has no machine-readable output. Passing `--agent`, `--fields`, `--budget` or `--full` is refused rather than silently ignored, and the refusal names the alternative: run the command without the flag, then read the resulting state with `fjall connect status --agent`.

## Options

| Flag                | Description                                                                                   | Default     |
| ------------------- | --------------------------------------------------------------------------------------------- | ----------- |
| `[awsAccountId]`    | 12-digit AWS account id to reconnect (auto-selected when exactly one account is disconnected) | Auto-select |
| `--non-interactive` | Force plain CLI output (no UI)                                                                | Off         |
| `-v, --verbose`     | Enable verbose output                                                                         | Off         |

## Next Steps

<CardGroup cols={2}>
  <Card title="fjall connect" icon="link" href="/cli/connect">
    Connect a new AWS account and check connection status.
  </Card>

  <Card title="Deploy account infrastructure" icon="server" href="/deployment/deploy-account">
    Run `fjall account deploy` after trust is restored.
  </Card>

  <Card title="fjall drift" icon="radar" href="/cli/drift">
    Detect and repair drift once the account is reachable again.
  </Card>

  <Card title="fjall deploy" icon="rocket" href="/cli/deploy">
    Deploy your applications into the reconnected account.
  </Card>
</CardGroup>
