The Tablestore client provides a series of methods to manage tables and perform read and write operations on a single row or multiple rows.

Obtain an endpoint

An endpoint is the domain name that is used to access a Tablestore instance in a region. To query an endpoint, perform the following operations:

  1. Log on to the Tablestore console.
  2. Go to the Instance Details tab. You can view the endpoints of the instance in the Instance Access URL section.
Note For more information about the endpoints, see Endpoint.

Configure an AccessKey pair

To access Tablestore, you must have an AccessKey pair that consists of an AccessKey ID and an AccessKey secret to verify your identity. For more information, see Create an AccessKey pair.

After you obtain an AccessKey pair (AccessKey ID and AccessKey secret), you must initialize a Tablestore client instance as follows:

Use the endpoint of the Tablestore instance to create a client.

  • Operation
        /// <summary>
        /// OTSClient constructor.
        /// </summary>
        /// <param name="endPoint">The endpoint of the Tablestore instance. Example: It must start with https://. </param>
        /// <param name="accessKeyID">The AccessKey ID to access the Tablestore instance. You can apply for an AccessKey ID on the Alibaba Cloud official website. </param>
        /// <param name="accessKeyID">The AccessKey secret that is used to access the Tablestore instance. You can apply for an AccessKey secret on the Alibaba Cloud official website. </param>
        /// <param name="instanceName">The name of the Tablestore instance. You can create an instance name in the Tablestore console. </param>
    public OTSClient(string endPoint, string accessKeyID, string accessKeySecret, string instanceName);
        /// <summary>
        /// Create an OTSClient instance by configuring the instance of the OTSClientConfig class.    /// </summary>
        /// <param name="config">The instance for client configurations.</param>    public OTSClient(OTSClientConfig config);
  • Examples
        // Create an OTSClientConfig instance.    
        var config = new OTSClientConfig(Endpoint, AccessKeyId, AccessKeySecret, InstanceName);
        // Disable log output. By default, this function is enabled.    
        config.OTSDebugLogHandler = null;
        config.OTSErrorLogHandler = null;
        // Create an OTSClient instance by using OTSClientConfig.    
        var otsClient = new OTSClient(config); 
        // Use OTSClient to insert or query data.                    
  • You can set the ConnectionLimit parameter in the OTSClientConfig instance. The default value of ConnectionLimit is 300.
  • You can set OTSDebugLogHandler and OTSErrorLogHandler in OTSClientConfig to specify whether to display logs.
  • The retry logic is customizable and controlled by RetryPolicy in OTSClientConfig. A default retry policy is provided.


  • Multithreading is supported.
  • We recommend that you use the same OTSClient instance to perform multithreading tasks.