All Products
Document Center

ApsaraDB for Redis:AllocateDirectConnection

Last Updated:May 28, 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.


OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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
  • DBInstance

Request parameters


The ID of the instance.


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.


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


Response parameters


The ID of the request.



Sample success responses


  "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.-

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

Change history

Change timeSummary of changesOperation
No change history