This topic describes how to connect to OceanBase Cloud by using Amazon Web Services (AWS) PrivateLink.
Prerequisites
- You have registered an AWS account.
- You have registered an OceanBase Cloud account and created a cluster instance and a tenant. For more information, see Create an instance and Create a tenant. This topic uses the MySQL-compatible tenant as an example.
- Ensure that your client IP address has been added to the allowlist of the tenant. For specific operations, see Configure the IP address allowlist.
Use a private network connection for the first time
If your instance does not have an available private IP address, you need to create one first and then obtain the connection string.
Log in to the OceanBase Cloud console and click Networking in the left-side navigation pane.
On the Network Configuration page, click Create Private Connection.
In the dialog box that appears, complete the configuration for Step 1: Create an endpoint service as described below, and then click Create.
ParameterDescriptionSelect Cloud Provider Select AWS. Select Instance or Tenant Select the instance and tenant to which you want to connect. Enter Counterparty Root Account The AWS account ID. You can go to the AWS console and copy the account ID from the drop-down menu next to the username in the upper-right corner. Create an AWS endpoint.
Create it through the AWS console.
In Step 2: Create an endpoint, copy and save the Service ID.
Go to the AWS console and search for Endpoint in the search bar. Select Features > Endpoints.
On the Endpoints page, click Create Endpoint, then enter the following configuration information, and click Create Endpoint.
ParameterDescriptionName Enter a custom name. Type Select Endpoint Service Using NLB and GWLB. Service Name Enter the service ID copied in Step 2: Create an endpoint and click Verify Service. VPC Select the VPC for creating the endpoint and select the target subnet. After the AWS endpoint is successfully created, copy the VPC Endpoint ID. On the Endpoints page, select the newly created endpoint, choose Actions > Modify Private DNS Name, and then enable Enable Private DNS Name for this endpoint.
Create via the command line
Go to the Amazon VPC console and obtain the VPC ID and subnet ID.
On the Step 2: Create an endpoint > Create by using AWS CLI tab, copy the command for creating the endpoint.
On the command-line page of the AWS console, execute the copied command.
After creation is complete, visit the endpoint page and copy the VPC Endpoint ID. On the endpoint page, select the newly created endpoint, choose Actions > Modify Private DNS Name, and then, under Enable Private DNS Name, select Enable for this endpoint and save.
Return to the OceanBase Cloud console. In Step 2: Create an endpoint, enter the copied VPC Endpoint ID and click Create Endpoint.
After the endpoint is created, confirm that PrivateDNS is enabled. In Step 3: Enable private DNS, click OK.
In Step 4: Access Database, select an existing database and account, or create a new one.
Note
When creating the account, please keep the generated password in a secure place.
Select a connection method as needed, such as OBClient, and copy the generated connection string to your client for connection. After a successful connection, you can access and use the database.
You already have an available private IP address
If you already have an available private IP address, you can select an existing private network connection and connect directly. The following describes how to connect using an existing private network connection. If you need to create a new private network connection, refer to the Use a private network connection for the first time section above to create one.
Log in to the OceanBase Cloud console. On the instance list page, expand the information for the target instance, and under the target tenant, select Connect > Get Connection String.
In the dialog box that appears, select Use Private IP Address.
In Step 4: Access Database, select your database and account, or choose to create a new one.
Note
If you choose to create a new account, please keep the password generated during account creation securely.
Select a connection method as needed, such as OBClient, and copy the generated connection string to your client for connection. After a successful connection, you can access and use the database.
You can click Enable One-Part Connection String on the page to enable the one-part connection string feature. After it is enabled, the connection string format changes to:
obclient -h <host> -P <port> -u <username> --ssl-ca=<path>/ca.pem -p
Note
- The difference between one-part and two-part connection strings: A two-part connection string requires specifying both the ODP host address and port, while a one-part connection string only requires the database service address, making it more concise.
- After you click Enable One-Part Connection String, the page displays the one-part connection string for you to copy and use.
- Before using a one-part connection string, ensure that your client IP address has been added to the allowlist; otherwise, you will not be able to access the database normally.
- Existing two-part connection strings remain usable after you enable this feature.
- If the Enable One-Part Connection String button is grayed out, the current ODP version is earlier than v4.3.6 and does not support this feature. Contact OceanBase Cloud Technical Support to request an upgrade.
What to do next
After creating an endpoint, you can view the information about the created endpoint under the topology diagram on the tenant workspace page. If you need to modify an existing endpoint due to reasons such as changing the VPC, OceanBase Cloud currently supports deleting the existing endpoint and recreating it. To delete an endpoint, perform the following operations:
On the instance list page of the OceanBase Cloud console, click the name of the target tenant to enter the tenant workspace.
Under the Topology Diagram on the tenant workspace page, click the delete button to delete the created endpoint.
