# Backups

Backups are experimental. Endpoints, request and response formats, and behavior can change during development.

A backup captures deployment storage at a point in time. Use backups to protect data or save the current state before an upgrade. LaserData creates EBS snapshots of the selected storage volumes.

Backups require an AWS deployment with network storage and a Performance or Enterprise plan. NVMe SSD deployments do not support backups.

## How It Works

Select a node to back up its storage volumes, or omit the node to back up all nodes. The backup runs in the background. Its status moves from Pending to In Progress to Completed.

## Backup Types

| Type | API Value | Description |
| --- | --- | --- |
| Manual | `manual` | Created on demand from the Console or API |
| Scheduled | `scheduled` | Created automatically on a recurring schedule |
| Pre-upgrade | `pre_upgrade` | Automatically created before deployment upgrades |

## Backup Status

| Status | Meaning |
| --- | --- |
| Pending | Backup requested, waiting to start |
| In Progress | Snapshot creation in progress |
| Completed | Backup finished successfully |
| Failed | Backup encountered an error |
| Deleting | Backup is being removed |

Only one backup can run for a deployment at a time.

## Creating a Backup

### From the Console

1. Open your deployment in the Console.
2. Open the Backups tab.
3. Click Create Backup.
4. Enter a name.
5. If you want automatic expiry, enter the number of days.
6. Click Create.

## Managing Backups

The Backups tab lists each backup's status, size, and creation time. Delete unused backups to release snapshot storage. Reading backups requires `deployment:read`. Creating or deleting them requires `deployment:manage`.

Wait for a backup to finish before you delete it. You cannot delete a backup with pending or in-progress status.

## Plan Limits

| Resource | Standard | Performance | Enterprise |
| --- | --- | --- | --- |
| Backups per deployment | - | 3 | 5 |
| Backup retention | 7 days | 30 days | 365 days |
| Backup regions | 1 | 3 | 10 |

## API Reference

### List Backups

```bash
curl {supervisor_url}/deployments/{deployment_id}/backups \
  -H "ld-api-key: YOUR_API_KEY"
```

```json
[
  {
    "id": 1,
    "deployment_id": 611298765432109056,
    "node_id": 1,
    "name": "pre-upgrade-backup",
    "backup_type": "manual",
    "status": "completed",
    "snapshot_ids": ["snap-0abc123def456789a"],
    "volume_ids": ["vol-0abc123def456789a"],
    "size_bytes": 53687091200,
    "region": "us-west-1",
    "remarks": null,
    "started_at": "2025-01-15T10:30:00Z",
    "completed_at": "2025-01-15T10:45:00Z",
    "expires_at": "2025-02-14T10:30:00Z",
    "created_at": "2025-01-15T10:30:00Z"
  }
]
```

### Create a Backup

```bash
curl -X POST {supervisor_url}/deployments/{deployment_id}/backups \
  -H "ld-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "before-migration",
    "remarks": "Snapshot before schema migration",
    "expires_in_days": 30
  }'
```

| Field | Required | Description |
| --- | --- | --- |
| `name` | Yes | Name for the backup |
| `node_id` | No | Specific node to back up (all nodes if omitted) |
| `backup_type` | No | `manual` (default), `scheduled`, `pre_upgrade` |
| `remarks` | No | Optional description |
| `expires_in_days` | No | Auto-delete after this many days |

A successful request returns `204 No Content`.

### Restore a Backup

A restore replaces the deployment's storage volumes with the backup snapshots. The deployment stops during the restore and restarts automatically. Only one restore can run for a deployment at a time.

Before you restore, make sure that you can discard data written after the backup. The restore replaces the current storage volumes and loses that data. You can create a new backup first.

```bash
curl -X POST {supervisor_url}/deployments/{deployment_id}/backups/{backup_id}/restore \
  -H "ld-api-key: YOUR_API_KEY"
```

A successful request returns `204 No Content`.

### Delete a Backup

```bash
curl -X DELETE {supervisor_url}/deployments/{deployment_id}/backups/{backup_id} \
  -H "ld-api-key: YOUR_API_KEY"
```

A successful request returns `204 No Content`.

- [Deployment Models](/deployments)
- [Tiers & Storage](/deployments/tiers-storage)
- [Configuration](/deployments/configuration)

Source: https://docs.laserdata.com/deployments/backups
