# Instances

PostgreSQL database services can be deployed on the Tessell portal with the following configurations:

| Instance type                                         | Description                                                                                                                                                                                                                                                                                                                                                                                                           |
| ----------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Single instance database service                      | Database service with one instance in a given region and availability zone.                                                                                                                                                                                                                                                                                                                                           |
| Multi-AZ database service                             | Database service with 2 instances, one primary and one synchronous replica. The instances must be in the same region but can be in the same or different availability zone as the primary instance. The two instances are always homogeneous in nature (infrastructure, parameters, storage, IOPS, and so on). All planned operations are performed in rolling mode on these services, keeping downtime to a minimum. |
| Database service with Disaster Recovery instance (DR) | Disaster Recovery instances are asynchronous replica instances that can be added in the same or different region as the primary. Multiple DR instances can be added to a database service. No automatic failover support. DR can be added to both single instance and Multi-AZ database services.                                                                                                                     |
| Database service with Read Replica                    | Read Replica is an asynchronous replica opened in read-only mode. You can use this instance for read-only queries.                                                                                                                                                                                                                                                                                                    |

### Create Replica

For any database service, you can add new replicas using the **Create Replica** button in the top-right corner. The possible options are **Disaster Recovery** and **Read Only Replica**.

**Prerequisites**:

* Open bi-directional communication between the primary and DR/Read Replica subnets at the subnet level for the following ports:
  * Primary database port (for example, 5432 for PostgreSQL, or your specific database port) and port 1599. This must cover the entire CIDR blocks of the subnets.
* NSG (Network Security Group) rules must be applied at the subnet level, not the VM level, as VM-level NSG is managed by Tessell.

1. Select **Disaster Recovery** or **Read Only Replica** to add the new node.
2. **For adding a DR node or a Read Replica node:**\
   The **Add a DR Instance** or **Add a RR Instance** window appears. Provide the following details:

   1. **Instance Name** — Specify the name for the instance. Instance names must contain only alphanumeric characters.
   2. **Region** — Select an available region from the dropdown list.
   3. **Availability Zone** — Select an availability zone from the dropdown list.
   4. **VPC** — Select an available VPC from the dropdown list.
   5. **Private Subnet** — Select an available private subnet from the dropdown list.
   6. Click **Add Instance** to proceed.

   Adding the Disaster Recovery or Read Replica instance automatically initiates the following steps:

   * Request to add the replica is submitted
   * Compute instance(s) are created
   * Primary database is prepared to add the new replica
   * Replica database is configured with primary database information
   * Availability Machine is set up for the new instance

As an alternative method, use the code to add the instance.

1. Click the **Code** button in the top-right corner to view the **Code for Add New Instance** window.
2. On the left-hand side, view the API, its type, and the payload.
3. On the right-hand side, view the code to create instances in Shell, Python, Go, Java, JavaScript, and PowerShell.
4. Use the copy and download buttons to save the code.
5. Click **Close** to return to the main window.

The Instances tab displays the list of all configured instances for your database service in tabular format. Each row displays the details of each instance configured per node. Each column provides the following information:

* **Name** — Displays the name of the instance configured as per the node, along with the node number. This name is generated automatically in incremental order:
  * `default-node-0` for primary
  * `default-node-1` for replica 1, typically an HA replica configured for automatic failover
  * `<instance name>-node-<digit>` for replica 2 onwards, where the digit starts from 0 for a new Read Replica or DR replica and increases as per the number of nodes configured
* **Status** — Displays the status of each instance. The status of the instances can be:

| Status                             | Description                                                                                                                                                                                                                   | Actions Allowed                                                                                                                                                       |
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| UP                                 | The database instance is up and running. Connections are allowed when it is in UP status.                                                                                                                                     | <ul><li>Resize the compute shapes</li><li>Resize the storage</li><li>Update the parameter profile</li><li>Delete the instance if it is a Read Replica or DR</li></ul> |
| DOWN                               | The database instance is down.                                                                                                                                                                                                | Raise a Tessell support ticket if the instance needs to be revived.                                                                                                   |
| STOPPED                            | The database instance is not running and is completely stopped.                                                                                                                                                               | Start the service                                                                                                                                                     |
| CREATING                           | Database instance provision is triggered and the creation process is in progress, or a new instance is being added to the existing database service.                                                                          | No actions allowed                                                                                                                                                    |
| DELETING                           | Database instance delete is triggered and the deletion process is in progress, or an instance is selected to be deleted from the database service. Only Read Replica and DR instances can be deleted from a database service. | No actions allowed                                                                                                                                                    |
| REBUILDING                         | Compute shape or storage resize is triggered for the instance.                                                                                                                                                                | No actions allowed                                                                                                                                                    |
| REBUILD\_FAILED                    | Compute resize or storage resize was triggered and did not complete.                                                                                                                                                          | All actions are allowed                                                                                                                                               |
| PATCHING                           | Available patches are selected to apply for the database service.                                                                                                                                                             | No actions allowed                                                                                                                                                    |
| PATCH\_FAILED                      | Patching for the database instance has failed.                                                                                                                                                                                | All actions are allowed                                                                                                                                               |
| UPDATING\_PARAMETER\_PROFILE       | Parameter profile update is triggered for the instance.                                                                                                                                                                       | No actions allowed                                                                                                                                                    |
| PARAMETER\_PROFILE\_UPDATE\_FAILED | Parameter profile update failed.                                                                                                                                                                                              | All actions are allowed                                                                                                                                               |

* **Role** — Displays the role of your instance. The possible values are Primary, HA Replica (Automatic Failover), Read Replica (RR), and Disaster Recovery (DR). Below the role is the name of the server where your instance resides.
* **Server** — Displays the server name where the instance is deployed. Clicking the server name takes you to that server's home page in the Servers app.
* **Region/Zone** — Displays the name of the cloud and its region on which your instance is hosted.
* **Parameter Profile** — Displays the name of the parameter profile selected for your instance at the time of provisioning.
* **Compute** — Displays the name of the compute shape selected for your instance at the time of provisioning. The allocated vCPUs and memory for this compute shape are displayed below the name.
* **Created** — Displays the date and time at which your instance was created.
* **Storage** — Displays the storage size specified during provisioning. To view the storage provider, throughput, and IOPS, click **See details** below the storage size.
* **Connection Endpoint** — Displays the host name for your instance. To view the Service URL, Host, Port, and Username, click **See Details** below the host name.
* Using the ellipsis icon, you can create private links for DR and RR nodes separately. You can create, update, or delete this private link.

  > **Note**: Creation of private links for DR and RR nodes is currently supported for AWS cloud only.

### Switch over

Tessell platform provides High Availability (HA) and Disaster Recovery (DR) capabilities through its **Switchover** functionality. This feature enables seamless transition of services from a primary instance to a designated HA replica or DR instance, ensuring minimal downtime and uninterrupted service availability.

To manually initiate a switchover:

1. Click **Switch over**.\
   The **Switch over to an instance** window appears with the options to switch, displaying the list of available replica instances along with their names and statuses.

   > **Note**: Switching over to an instance may cause some downtime for the service.
2. Select the replica instance to promote as primary and optionally add comments. If an HA replica is chosen as the target, the switchover is graceful (planned and synchronized with no data loss) and a switchback is allowed.
3. Select the **I understand the consequences** check box and click **Switch**.\
   The switching request is submitted.
4. To view the progress, select **Submitting Request** below the service name.\
   After the request is submitted, the switchover operation starts to promote the replica to primary. After it completes, the service returns to Ready status and Tessell metadata is updated.

### PostgreSQL DR Drills

When initiating a switchover to a **DR instance**, Tessell provides two distinct operational paths based on the intent of the switchover, controlled by the **DR Drill** flag.

1. **DR Drill (Graceful Switchover)**
   * If the **DR Drill** option is selected during the switchover, the platform attempts a graceful switchover from the current primary to the DR instance.
   * This ensures that:
     * The DR instance is checked for replication sync with the primary before proceeding.
     * The current primary is demoted in a controlled manner.
     * The DR instance is promoted to primary with data consistency.
   * If the DR instance is out of sync with the primary, the switchover fails to prevent data inconsistency.
   * This mode is typically used for DR testing and compliance drills, with the ability to switch back to the original primary after testing is complete.
2. **Actual Disaster Recovery (Forceful Switchover)**

   * If the **DR Drill** option is not selected, the platform treats this as a real disaster scenario.

   * In this case:
     * Tessell forcefully promotes the DR instance to become the new primary.
     * The original primary is brought down.
     * The DR node requires a manual rebuild to restore replication consistency.

   * Use this mode only when performing an actual failover in a disaster scenario.

   > **Note**: Ensure you select the **DR Drill** option when performing a planned DR test. Initiating a switchover without the DR Drill option enabled treats the operation as a real disaster recovery and brings down the original primary.

**Figure 1: Instances tab**

![](/files/opk6bUy8lXgv0th7L1y8)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tessell.com/tessell/tessell-for-postgresql/db-services/readme-postgresql/homepage-postgresql/instances-postgresql.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
