You can connect to an ApsaraDB for Redis instance by using a public endpoint. Compared with an internal endpoint, you may experience higher network latency if you use an public endpoint. We recommend that you connect to an ApsaraDB for Redis instance by using an internal endpoint in a production environment to ensure optimal service performance .

Prerequisites

  • The public IP address of the Elastic Compute Service (ECS) instance or an on-premises machine is added to the whitelist of the ApsaraDB for Redis instance. For more information, see Step 2: Set IP address whitelists.
  • You cannot apply for public endpoints for instances of ApsaraDB for Redis 2.8 or 5.0 that have the password-free access feature enabled. We recommend that you disable this feature before you apply for public endpoints. For more information, see Enable password-free access.
    Note You can apply for public endpoints for instances of ApsaraDB for Redis 4.0 that have the password-free access feature enabled. Then, you can use a private endpoint to access an ApsaraDB for Redis instance without a password. However, if you use a public endpoint to access an ApsaraDB for Redis instance, a password is still required.
  • If you use a custom account to connect to the ApsaraDB for Redis instance, the format of the connection string must be <user>:<password>. For example, if the username of the custom account is admin and the password is Rp829dlwa, you can use admin:Rp829dlwa to log on to the ApsaraDB for Redis instance.

Scenarios

  • Local access: You can access an ApsaraDB for Redis instance from an on-premises machine.
  • Cross-account access: You can access ApsaraDB for Redis instances that are owned by other Alibaba Cloud accounts from your ECS instance.
  • Cross-region access: You can create connections between an ECS instance and an ApsaraDB for Redis instance. The two instances are owned by the same Alibaba Cloud account but deployed in different regions.
  • Cross-VPC access: You can create connections between an ECS instance and an ApsaraDB for Redis instance. The two instances are owned by the same Alibaba Cloud account and deployed in the same region, but in different virtual private clouds (VPCs).
  • Cross-network access: You can create connections between an ECS instance and an ApsaraDB for Redis instance. The two instances are owned by the same Alibaba Cloud account and deployed in the same region, but of different network types.

Pricing

Public endpoints of ApsaraDB for Redis instances and Internet data transfer are free of charge.

Apply for a public endpoint

  1. Log on to the ApsaraDB for Redis console.
  2. On the top of the page, select the region where the instance is deployed.
  3. On the Instances page, click the Instance ID of the instance.
  4. In the Connection Information section, click Apply for Public Endpoint.
    Apply for a public endpoint
  5. In the dialog box that appears, enter an endpoint and a port number or use the default values.
  6. Click OK.
    After the operation is complete, you can view the public endpoint in the Connection Information section.
    Note If you no longer use the public endpoint, click Release Public Endpoint to release the endpoint.

Use a public endpoint to connect to an ApsaraDB for Redis instance

You can use redis-cli or Redis clients of other languages to connect to ApsaraDB for Redis instances. For more information, see the following topics:

Solutions to connection issues over the Internet