Every ApsaraDB RDS for PostgreSQL instance has at least one endpoint and port number for database connections. The available endpoint types depend on your RDS edition. For more information about how to connect using these endpoints, see Connect to an ApsaraDB RDS for PostgreSQL instance.
-
RDS Basic Edition and RDS High-availability Edition: instance endpoint and database proxy endpoint
-
RDS Cluster Edition: read/write endpoint and read-only endpoint
RDS Basic Edition and RDS High-availability Edition
Endpoint types
| Endpoint type | Description |
|---|---|
| Instance endpoint | Suitable for all connection scenarios. Includes an internal endpoint for low-latency access over the internal network (for example, from an ECS instance within the same VPC) and a public endpoint for access over the Internet. |
| Database proxy endpoint | Available when the database proxy feature is enabled. We recommend that you use the database proxy endpoint if this feature is enabled for your instance. This improves read/write splitting performance and reduces load on the primary instance. For more information, see What are database proxies?. |
Change the instance endpoint and port number
Prerequisites
Before you begin, ensure that you have:
-
An IP address whitelist configured for the instance. For more information, see Configure an IP address whitelist
-
A public endpoint applied for, if needed. For more information, see Apply for or release a public endpoint
Procedure
-
Go to the Instances page. In the top navigation bar, select the region of your RDS instance, then click the instance ID.
-
In the left-side navigation pane, click Database Connection to view the internal and public endpoints and port numbers.
-
In the Database Connection section, click Modify Endpoint.
-
Set Connection Type to Internal Endpoint or Public Endpoint. Modify the Endpoint prefix and Port number, then click OK.
The endpoint prefix must be 8 to 64 characters in length and can contain lowercase letters, digits, and hyphens (-). It must start with a lowercase letter. The port number must be in the range of 1000 to 5999. If your RDS instance runs on premium local SSDs, the port number cannot be changed.
Change the database proxy endpoint and port number
Prerequisites
Before you begin, ensure that you have:
-
The database proxy feature enabled. For more information, see Enable the database proxy feature
Procedure
-
Go to the Instances page. In the top navigation bar, select the region of your RDS instance, then click the instance ID.
-
In the left-side navigation pane, click Database Proxy.
-
In the Connection Information section, find the database proxy endpoint and click the edit icon to its right.
-
Modify the Endpoint prefix and Port number, then click OK.
The database proxy endpoint prefix must be 1 to 40 characters in length and can contain lowercase letters, digits, and hyphens (-). It must start with a lowercase letter. The port number must be in the range of 1000 to 5999. The Endpoint Type value cannot be changed.
FAQ
After I change an endpoint or port number, do I need to update my application?
Yes. Update the endpoint or port number in your application immediately, or connections to the instance will fail.
Do endpoint or port number changes take effect immediately? Is a restart required?
Changes take effect immediately. No instance restart is needed.
Can I reuse an endpoint after I release it?
Yes. After an endpoint is changed or released, the previous endpoint becomes available for other RDS instances.
Does a primary/secondary switchover change the endpoints?
No. Endpoints remain the same during a primary/secondary switchover. Only the underlying IP addresses change. Your application can continue connecting through the same endpoints without modification.
RDS Cluster Edition
An RDS instance that runs RDS Cluster Edition is referred to as an RDS cluster. Each cluster supports two endpoint types for different access patterns.
Endpoint types
| Endpoint type | Description |
|---|---|
| Read/write endpoint | One per cluster. Connects only to the primary node. During a primary/secondary switchover, the endpoint automatically routes to the new primary node. Consists of an internal endpoint (auto-generated at cluster creation) and an optional public endpoint. |
| Read-only endpoint | One per cluster. Routes traffic to one or more secondary nodes. Supports adding and removing nodes and adjusting node weights for load balancing. The number of secondary nodes always matches the user-defined count. If a secondary node fails, it is automatically rebuilt. If a secondary node is promoted to primary, a new secondary node is automatically added to the read-only endpoint. |
View and manage the read/write endpoint
The read/write endpoint consists of internal and public endpoints. An internal endpoint is automatically generated when the cluster is created. Apply for a public endpoint based on your business requirements.
-
Go to the Instances page. In the top navigation bar, select the region of your RDS instance, then click the instance ID.
-
On the Basic Information page, locate the Database Connection section within Instance Topology Management.
-
View the read/write endpoint: Hover over the Read/Write Mode card to see the endpoint in the tooltip.
-
Change the read/write endpoint or apply for a public endpoint: Click Edit and perform one of the following actions:
-
Click Change Connection to change the internal endpoint and port number.
-
Click Change VPC to switch the VPC and vSwitch.
-
Click Apply for to apply for a public endpoint.
-
-
Alternatively, click Apply for Public Endpoint to apply for a public endpoint.
View and manage the read-only endpoint
-
Go to the Instances page. In the top navigation bar, select the region of your RDS instance, then click the instance ID.
-
On the Basic Information page, locate the Database Connection section within Instance Topology Management. Perform operations as needed:
Create a read-only endpoint
The cluster must be in the Running state. Creating a read-only endpoint does not affect existing read and write requests. Only one read-only endpoint is allowed per cluster. An internal endpoint is automatically generated for the read-only endpoint, providing load balancing across secondary nodes.
-
Click Add Endpoint.
-
In the dialog box, configure the Internal Endpoint Prefix, Port, VPC, and vSwitch. Add the secondary nodes to access and adjust their weights.
-
Click OK.
Delete a read-only endpoint
Deleting a read-only endpoint releases both its internal and public endpoints and interrupts all established connections. Existing read and write requests to the cluster are not affected.
-
In the Read-only Mode card, click Delete.
-
In the confirmation message, click OK.
View the read-only endpoint
Hover over the Read-only Mode card to see the read-only endpoint.
Add or remove nodes
The cluster must be in the Running state. At least one node must remain in the read-only endpoint. Node configuration changes apply to both the internal and public endpoints of the read-only endpoint.
Add nodes:
-
In the Read-only Mode card, click Edit and select the node to add.
-
Click the add icon to include the node.
-
Adjust node weights as needed, then click OK.
Adding nodes does not affect existing persistent connections. New connections are distributed based on the updated weights.
Remove nodes:
-
In the Read-only Mode card, click Edit and select the node to remove.
-
Click the remove icon, then click OK.
Removing a node causes approximately 30 to 120 seconds of unavailability for that node. Connections to other nodes are not affected.
Adjust node weights
The cluster must be in the Running state. At least one node must have a weight greater than 0. Weight changes apply to both the internal and public endpoints of the read-only endpoint.
-
In the Read-only Mode card, click Edit.
-
Adjust the node weights in the dialog box, then click OK.
Existing connections are not affected. Only new connections follow the updated weight distribution.
FAQ
Why do nodes with the same weight show different CPU and memory usage?
Server Load Balancer (SLB) distributes connections evenly across nodes, but the resource consumption of individual connections varies. Identical connection counts do not guarantee identical CPU or memory usage.
Does adjusting node weights cause downtime?
No. Existing connections remain active. Only new connections are routed according to the updated weights.
Can I set all node weights to 0?
No. At least one node must have a weight greater than 0.
Can I remove all nodes from the read-only endpoint?
No. At least one node must remain in the read-only endpoint.
API reference
The following API operations are available for managing endpoints of ApsaraDB RDS for PostgreSQL instances that run RDS Cluster Edition.
| Operation | Description |
|---|---|
| CreateDBInstanceEndpoint | Creates an endpoint |
| DescribeDBInstanceEndpoints | Queries endpoints |
| ModifyDBInstanceEndpointAddress | Modifies an endpoint address |
| CreateDBInstanceEndpointAddress | Creates a public endpoint |
| DeleteDBInstanceEndpointAddress | Releases a public endpoint |
| DeleteDBInstanceEndpoint | Deletes an endpoint |
| ModifyDBInstanceEndpoint | Modifies the weight of an endpoint |