---
title: "replicas add"
description: "Add a read replica"
canonical: "https://pgbeam.com/docs/cli/projects/replicas/add"
last-updated: "2026-10-29T19:01:20.000Z"
---

# replicas add

> Add a read replica

URL: https://pgbeam.com/docs/cli/projects/replicas/add

{/* Auto-generated from CLI commands. Do not edit. Run `pnpm generate:cli-docs` to regenerate. */}

Add a read replica to a database connection. PgBeam can route read-only queries to replicas for improved performance and load distribution. Without the `--host` flag, the command prompts for the replica hostname interactively.

## Usage

```bash
pgbeam replicas add [flags]
```

## Options

| Option                  | Description                                                      | Required | Default |
| ----------------------- | ---------------------------------------------------------------- | -------- | ------- |
| `--database-id <value>` | ID of the database to add the replica to                         | Yes      | -       |
| `--host <value>`        | Hostname or IP address of the replica server                     | No       | -       |
| `--port <value>`        | Port number of the replica server                                | No       | `5432`  |
| `--ssl-mode <value>`    | SSL connection mode: disable, require, verify-ca, or verify-full | No       | -       |

> **Global options**
>
> All [global options](/docs/cli/global-options) (`--token`, `--profile`,
> `--project`, `--org`, `--json`, `--no-color`, `--no-trunc`, `--debug`) are
> also available on this command.

## Examples

```bash
# Add a replica interactively
pgbeam replicas add --database-id db_xxx

# Add a replica with all flags
pgbeam replicas add --database-id db_xxx --host replica.example.com --port 5432 --ssl-mode require
```

## Output

Prints the new replica ID. With `--json`, returns the full replica object.