PgBeam Docs
Projects

createReplica

Add a replica

Adds a read replica to a database.

Usage

const result = await api.projects.createReplica({
  pathParams: { database_id: "db_xxx" },
  body: {
    host: "replica.us-west-2.rds.amazonaws.com",
    port: 5432,
  },
});

Parameters

ParameterTypeRequiredDescription
pathParams.database_idstringYesUnique database identifier (prefixed, e.g. db_xxx).
body.hoststringYesPostgreSQL replica host.
body.portnumberYesPostgreSQL replica port.
body.ssl_modeSSLModeNo

Response

Promise<Replica> — replica created.

Example

import { PgBeamClient } from "pgbeam";

const client = new PgBeamClient({
  token: "pbk_...",
  baseUrl: "https://api.pgbeam.com",
});

const result = await client.api.projects.createReplica({
  pathParams: { database_id: "db_xxx" },
  body: {
    host: "replica.us-west-2.rds.amazonaws.com",
    port: 5432,
  },
});

Errors

StatusDescription
400Invalid request parameters.
401Missing or invalid authentication.
403Operation not allowed by current plan limits.
404Resource not found.
429Rate limited. Try again later.

On this page