> ## 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 sync

> Sync deployed AWS CloudFormation stack metadata to the Fjall dashboard for monitoring

<Warning>
  `fjall sync` is currently unavailable. The API endpoint it calls (`PUT /api/applications/:id/metadata`) is deprecated and returns `410 Gone`. Monitoring metadata is now collected automatically from your connected AWS account, so no manual sync step is required. This page documents the command for reference. Expect a `Failed to send metadata` error if you run it.
</Warning>

## Overview

The `fjall sync` command captures metadata from your deployed CloudFormation stacks and sends it to the Fjall API. The metadata powers monitoring and management features in the Fjall dashboard.

Monitoring data now flows directly from the AWS account you connect with `fjall connect`. The standalone sync step has been retired, so most workflows no longer call this command.

## Usage

```bash theme={null}
fjall sync [app-name] [options]
```

## Arguments

| Argument   | Description         | Required                                            |
| ---------- | ------------------- | --------------------------------------------------- |
| `app-name` | Application to sync | No (auto-detected when only one application exists) |

## Options

| Option              | Description                                           |
| ------------------- | ----------------------------------------------------- |
| `-v, --verbose`     | Show detailed output, including captured metadata     |
| `--non-interactive` | Force plain CLI output (no interactive UI)            |
| `--agent`           | Enable agent output mode                              |
| `--budget <level>`  | Output budget: `minimal`, `compact`, or a token count |
| `--fields <fields>` | Request additional fields in agent output             |
| `--full`            | Disable content truncation in agent output            |

## Prerequisites

`fjall sync` checks each prerequisite before running:

1. **Authenticated with Fjall**: run `fjall login`. Credentials are stored at `~/.fjall/auth.json`.
2. **Connected AWS account**: run `fjall connect`.
3. **Application deployed**: run `fjall deploy <app-name>` first so the CloudFormation stacks exist.
4. **API application ID**: the application must have an `apiApplicationId` in `fjall-config.json` (written on first deployment).

## What gets synced

The command captures and sends:

* CloudFormation stack outputs (endpoints, ARNs, resource names)
* ECS cluster and service information
* Lambda function ARNs
* Database endpoints
* S3 bucket names
* CloudWatch log group names
* Load balancer DNS names

This metadata lets the Fjall dashboard:

* Display application architecture
* Show real-time metrics
* Link directly to AWS resources
* Open logs for debugging

## How it works

```
fjall sync api

 Fjall Metadata Sync

Using application: api
Application ID: app_abc123
Syncing metadata for: api

Authenticating with AWS...
Authenticated successfully

Capturing metadata from CloudFormation...
Metadata captured successfully

Sending metadata to Fjall API...
```

The command runs three steps: authenticate with AWS, capture metadata from CloudFormation, and send it to the Fjall API. The final step currently fails because the target endpoint is deprecated.

## Configuration

The `apiApplicationId` is written to `fjall-config.json` after first deployment:

```json theme={null}
{
  "projectName": "myproject",
  "apps": {
    "api": {
      "appPath": "fjall/api",
      "apiApplicationId": "app_abc123xyz"
    }
  }
}
```

This ID links your local application to the Fjall dashboard.

## Multiple applications

When the repository holds several applications, name the one to sync:

```bash theme={null}
# Sync a specific application
fjall sync api
```

Running `fjall sync` with no name in a multi-application repository returns an error asking you to specify one:

```
Error: Multiple applications found. Please specify one.
```

## Troubleshooting

### Metadata send fails (410 Gone)

```
Error: Failed to send metadata: ... 410
```

**Cause**: the metadata endpoint is deprecated. Monitoring metadata is now sourced from your connected AWS account.

**Solution**: no action needed. Connect your AWS account with `fjall connect`. Monitoring data is collected automatically.

### No apiApplicationId

```
Error: Application "api" has no apiApplicationId. Deploy it first.
```

**Cause**: the application has not been deployed to Fjall yet.

**Solution**: deploy the application first:

```bash theme={null}
fjall deploy api
```

### Application not found

```
Error: No applications found in fjall-config.json
```

**Cause**: the application name does not match the config.

**Solution**: check `fjall-config.json` for the correct application names.

### Authentication failed

```
Error: Failed to authenticate with AWS
```

**Cause**: invalid or expired AWS credentials.

**Solution**: reconnect your AWS account:

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

## Next Steps

<CardGroup cols={2}>
  <Card title="fjall deploy" icon="rocket" href="/cli/deploy">
    Deploy an application to AWS so its CloudFormation stacks exist.
  </Card>

  <Card title="fjall connect" icon="aws" href="/cli/connect">
    Connect an AWS account, the source of automatic monitoring metadata.
  </Card>

  <Card title="fjall login" icon="key" href="/cli/login">
    Authenticate the CLI with Fjall before running commands.
  </Card>

  <Card title="fjall list" icon="list" href="/cli/list">
    List the resources defined in an application's infrastructure.
  </Card>
</CardGroup>
