This topic describes how to connect to an OceanBase Cloud database by using Amazon Web Services (AWS) PrivateLink.
Prerequisites
- You have registered an AWS account.
- You have registered an OceanBase Cloud account, and have created an instance and a tenant. For more information, refer to Create an instance and Create a tenant. In this topic, a MySQL-compatible tenant is used.
- Make sure your client IP address has been added to the allowlist of your tenant. For detailed instructions, refer to Set allowlist groups.
Use private network connection for the first time
If your instance does not have an available private endpoint, you need to create a private endpoint and then obtain the connection string.
Log in to the OceanBase Cloud console. In the left-side navigation pane, click Networking.
On the networking page, click Create Private Connection.
In the dialog box that appears, complete the configuration for Step 1: Create your endpoint service as described in the following table, and then click Create.
Parameter Description Select a cloud vendor Select AWS. Select an instance or tenant Select the instance and tenant to be connected. Enter the peer primary Account Enter the AWS account ID. You can go to the AWS console, click the username in the upper-right corner, and copy the account ID from the drop-down menu. Create an AWS endpoint.
Create an endpoint through the AWS console
Under Step 2: Create an endpoint, copy and save the Service ID.
Go to the AWS console, search for endpoints, and select Services > Endpoints.
On the endpoints page, click Create endpoint, and fill in the following configuration information, and then click Create endpoint.
Parameter Description Name Enter a custom name. Type Select Endpoint services that use NLBs and GWLBs. Service Name Enter the service ID copied in Step 2: Create an endpoint, and then click Verify service. VPC Select the VPC where you want to create the endpoint, and select the target subnet. After the AWS endpoint is created, copy the VPC Endpoint ID. On the endpoints page, select the newly created endpoint, choose Actions > Modify private DNS name, and then enable the private DNS name for the endpoint.
Create an endpoint through the AWS CLI
Go to the AWS console, and obtain and fill in the VPC ID and subnet ID.
On the Step 2: Create an endpoint > Create Through AWS CLI tab, copy the command to create an endpoint.
On the AWS console's CLI page, execute the copied command.
After the endpoint is created, go to the endpoints page, copy the VPC Endpoint ID, select the newly created endpoint, choose Actions > Modify private DNS name, and then enable the private DNS name for the endpoint.
Return to the OceanBase Cloud console. On the Step 2: Create an endpoint page, enter the copied VPC Endpoint ID and click Create Endpoint.
After the endpoint is created, enable the private DNS. On the Step 3: Enable private DNS page, click OK.
On the Step 4: Access Database page, select an existing database and account, or create a new database and account.
Notice
When you create an account, save the generated password securely.
Select a connection method, such as OBClient, and copy the generated connection string to your client for connection. After the connection is successful, you can access the database.
Already have an available private endpoint
If you have an available private endpoint, you can select an existing VPC connection for direct connection. The following describes how to use the existing VPC connection. If you need to create a new VPC connection, see the Use private network connection for the first time section for instructions.
Log in to the OceanBase Cloud console. On the instance list page, find the information about the target instance, expand it, click Connect, and then choose Get Connection String.
In the dialog box, select Private Network.
In Step 4: Access Database, select the database and user account you want or create a new database and user account.
Note
If you choose to create a new account, please make sure to save the password generated during account creation securely.
Choose a connection method, such as OBClient, and copy the generated connection string to your client to connect. After a successful connection, you can access and use the database.
Next steps
After you create an endpoint, you can view the endpoint information in the topology of the tenant overview page. If you need to modify the existing endpoints due to reasons such as a VPC change, you can delete the existing endpoints and recreate them as follows:
In the instance list on the OceanBase Cloud console, click the name of the target tenant to go to the tenant overview page.
In the Topology Diagram panel, click the Delete icon to delete the created endpoint.
