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 isadmin
and the password isRp829dlwa
, you can useadmin: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
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
- Make sure that you access an ApsaraDB for Redis instance through a public endpoint instead of an internal endpoint.
- You must add the public IP address of a client to the whitelist of the ApsaraDB for Redis instance. For more information, see Set IP address whitelists.
- For more information about how to fix issues of private network connections, see Troubleshooting for connection issues in ApsaraDB for Redis.