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

> Restore S3, EBS, RDS, and EC2 resources from AWS Backup recovery points with the Fjall CLI.

## Overview

`fjall restore` restores AWS resources from AWS Backup recovery points. It supports S3 buckets, EBS volumes, RDS databases, and EC2 instances.

## Usage

```bash theme={null}
fjall restore [resource] [options]
```

## Arguments

| Argument   | Description                                            | Required                           |
| ---------- | ------------------------------------------------------ | ---------------------------------- |
| `resource` | Resource type to restore: `s3`, `ebs`, `rds`, or `ec2` | No (interactive picker if omitted) |

## Options

| Option                   | Description                                           | Example                               |
| ------------------------ | ----------------------------------------------------- | ------------------------------------- |
| `--recovery-point <arn>` | Recovery point ARN (required in non-interactive mode) | `--recovery-point arn:aws:backup:...` |
| `-n, --name <name>`      | Name for the restored resource                        | `--name restored-db`                  |
| `-y, --yes`              | Skip the dry-run and start the restore immediately    | `-y`                                  |
| `-v, --verbose`          | Enable verbose logging                                | `-v`                                  |
| `--non-interactive`      | Force plain CLI output (no interactive UI)            | `--non-interactive`                   |

### Agent flags

These flags shape output for AI-agent and scripted callers.

| Flag                | Description                                           |
| ------------------- | ----------------------------------------------------- |
| `--agent`           | Enable agent output mode                              |
| `--budget <level>`  | Output budget: `minimal`, `compact`, or a token count |
| `--fields <fields>` | Request additional fields in output                   |
| `--full`            | Disable content truncation                            |

## Resource Types

### S3 Bucket

Restore an S3 bucket from backup:

```bash theme={null}
fjall restore s3 --recovery-point arn:aws:backup:ap-southeast-2:123456789:recovery-point:abc-123
```

### EBS Volume

Restore an EBS volume:

```bash theme={null}
fjall restore ebs --recovery-point arn:aws:backup:ap-southeast-2:123456789:recovery-point:abc-123
```

### RDS Database

Restore an RDS instance or Aurora cluster:

```bash theme={null}
fjall restore rds --recovery-point arn:aws:backup:ap-southeast-2:123456789:recovery-point:abc-123
```

### EC2 Instance

Restore an EC2 instance:

```bash theme={null}
fjall restore ec2 --recovery-point arn:aws:backup:ap-southeast-2:123456789:recovery-point:abc-123
```

## Interactive Mode

Run `fjall restore` with no recovery point to walk through a guided picker chain:

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

The picker steps through:

1. **Resource category** (`What type of resource would you like to restore?`): Compute or Storage.
2. **Resource type** (`Select compute resource type:` for EC2, or `Select storage resource type:` for S3, EBS, RDS).
3. **Backup vault** (`Select backup vault (N available):`): each vault shows its recovery-point count.
4. **Resource** (`Select resource to restore (N available):`): shows the backup count and latest backup date.
5. **Recovery point** (`Select a backup to restore (N available for <resource>):`): the most recent backup is labelled `(Latest)`.
6. **Confirmation** (`Start restore job?`): shown after a summary of the restore.

RDS restores additionally prompt for the DB instance name and port before the confirmation step.

Once confirmed, the restore job starts and the CLI prints the job ID and a console link to track progress:

```
Restoring RDS from AWS Backup
  Recovery Point: arn:aws:backup:ap-southeast-2:123456789:recovery-point:abc-123

  Starting restore job...
  Restore job ID: A1B2C3D4-5678-90AB-CDEF-EXAMPLE11111

Restore job started successfully!

Next steps:
  • View progress: https://console.aws.amazon.com/backup/home?region=ap-southeast-2#/jobs
```

## Non-Interactive Mode

For CI/CD or scripting, pass every required option and `--yes` to skip the dry-run:

```bash theme={null}
fjall restore rds \
  --recovery-point arn:aws:backup:ap-southeast-2:123456789:recovery-point:abc-123 \
  --yes \
  --non-interactive
```

## Finding Recovery Points

Find recovery points in:

1. **AWS Console**: Backup > Protected resources > select a resource.
2. **AWS CLI**:
   ```bash theme={null}
   aws backup list-recovery-points-by-resource \
     --resource-arn arn:aws:rds:ap-southeast-2:123456789:db:myapp-database
   ```

## Post-Restore Steps

After a restore completes:

1. **Verify the restored resource** in the AWS Console.
2. **Update application configuration** if the restored resource has a new name or endpoint.

<Note>
  Importing an existing AWS resource back into a Fjall application (`fjall import`) is not yet available. Track restored resources manually until import ships.
</Note>

## Troubleshooting

### Permission Denied

```
Error: Access denied

Ensure you have the following permissions:
  - backup:StartRestoreJob
  - iam:PassRole (for the restore role)
```

**Solution**: Grant your IAM role the AWS Backup permissions listed in [Required Permissions](#required-permissions).

### Recovery Point Not Found

```
Error: Recovery point not found

Verify the recovery point ARN is correct
```

**Solution**: Confirm the ARN is valid and the recovery point exists:

```bash theme={null}
aws backup describe-recovery-point \
  --backup-vault-name Default \
  --recovery-point-arn arn:aws:backup:...
```

### Restore Failed

If a restore job fails, check the AWS Backup console for details:

1. Go to AWS Console > Backup > Jobs.
2. Find the failed job.
3. Read the status message for the failure reason.

## Required Permissions

The restore command requires these IAM permissions:

```json theme={null}
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "backup:StartRestoreJob",
        "backup:DescribeRestoreJob",
        "backup:ListRecoveryPointsByResource"
      ],
      "Resource": "*"
    },
    {
      "Effect": "Allow",
      "Action": "iam:PassRole",
      "Resource": "arn:aws:iam::*:role/AWSBackupDefaultServiceRole"
    }
  ]
}
```

## Next Steps

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

  <Card title="fjall deploy" icon="rocket" href="/cli/deploy">
    Deploy application changes to AWS.
  </Card>

  <Card title="fjall tunnel" icon="plug" href="/cli/tunnel">
    Open a secure tunnel to a restored database.
  </Card>

  <Card title="fjall connect" icon="link" href="/cli/connect">
    Connect an AWS account before restoring its resources.
  </Card>
</CardGroup>
