All Products
Search
Document Center

Tair (Redis® OSS-Compatible):AllocateDirectConnection

Last Updated:Oct 30, 2024

Applies for a private endpoint for an ApsaraDB for Redis cluster instance.

Operation description

In direct connection mode, you can use private endpoints to bypass proxy nodes and connect to ApsaraDB for Redis instances from clients in the same manner as you connect to native Redis clusters. The direct connection mode can reduce communication overheads and accelerate the response speed. For more information, see Enable the direct connection mode.

To call this operation, the instance must meet the following requirements:

  • The instance is an ApsaraDB for Redis cluster instance.
  • The instance is a Community Edition instance that runs Redis 4.0 or 5.0, or an Enhanced Edition instance (Tair) that runs Redis 5.0.
  • The instance is deployed in a virtual private cloud (VPC). If the instance is deployed in the classic network, call the SwitchNetwork operation to change the network type to VPC.
  • SSL encryption is disabled for the instance. If SSL encryption is enabled, you can call the ModifyInstanceSSL operation to disable it.
  • The vSwitch to which the instance is connected has sufficient IP addresses to be allocated. For more information, see Obtain the number of available IP addresses in the vSwitch to which an ApsaraDB for Redis instance is connected.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
kvstore:AllocateDirectConnectioncreate
  • DBInstance
    acs:kvstore:{#regionId}:{#accountId}:instance/{#instanceId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringYes

The ID of the instance.

r-bp1zxszhcgatnx****
ConnectionStringstringNo

The prefix of the private endpoint. The prefix must start with a lowercase letter and can contain lowercase letters and digits. The prefix must be 8 to 40 characters in length.

redisdirect123
PortstringNo

The port number of the instance. Valid values: 1024 to 65535. Default value: 6379.

6379

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

5D622714-AEDD-4609-9167-F5DDD3D1****

Examples

Sample success responses

JSONformat

{
  "RequestId": "5D622714-AEDD-4609-9167-F5DDD3D1****"
}

Error codes

HTTP status codeError codeError messageDescription
400NetTypeExistsSpecified net type already existed-
400InvalidConnTypeSpecified DB instance conn type is not valid.-
400TaskHasExistThe task already exists.The task already exists.
400ConnectionStringAlreadyExistsSpecified connection string already exists in the Aliyun RDS.-
400InvalidConnectionString.FormatSpecified connection string is not valid.The connection string is invalid. Use a different one.
400DirectConnectionAlreadyExistsSpecified instance direct connection already exists.-
400InvalidVPCParamGroupSpecified vpc param group is not valid.-
400InvalidConnectionStringConnectionString is invalid, valid regex: ^\w+$The prefix of the endpoint is invalid. The prefix must start with a lowercase letter and can contain lowercase letters and digits. The prefix can be 8 to 40 characters in length.
403UnsupportedEngineVersionCurrent engine version does not support operations.-
403IncorrectMinorVersionCurrent engine minor version does not support operations.The operation is not supported by the minor version of the instance. Update the instance to the latest minor version and try again.
403InstanceStatus.NotSupportInstance status does not support this operation.The error message returned because the operation is not supported while the instance is in the current state.
404InvalidDbInstanceId.NotFoundSpecified instance does not exist.The specified instance does not exist

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history