Introduction
This topic describes how to connect ECS instances to apsaradb for Redis instances in different networks.
Background
If your ECS instance runs in a classic network and the apsaradb for Redis instance runs in a Virtual Private Cloud (VPC), or the apsaradb for Redis instance runs in a classic network and the ECS instance runs in a VPC, you can quickly connect both instances by following the procedures in this topic.
Background
VPCs and Alibaba Cloud classic network belong to different subnets and cannot directly interconnect with each other. If the ECS and apsaradb for Redis instances are in different networks (for example, the network type is incorrectly selected when the instance is created or the business architecture needs to be adjusted), and the business scenarios need to connect to the ECS and apsaradb for Redis instances as soon as possible, consider switching the network types of the apsaradb for Redis instance or using ClassicLink to achieve mutual access.
Note: the ClassicLink-based interconnection is a temporary solution in special conditions. To achieve efficient caching in the production environment, we recommend that you create the ECS and apsaradb for Redis instances in the same VPC.
The ECS instance in a classic network connects to the ApsaraDB for Redis instance in a VPC
You can establish a ClassicLink-based connection to allow the ECS instance in a classic network and the ApsaraDB for Redis instance in a VPC to interconnect with each other.
Prerequisites
- The ECS and ApsaraDB for Redis instances belong to the same account and run in the same region.
- The CIDR block of the VPC must follow the requirements of enabling the ClassicLink setting in the ClassicLink overview.
Note: to interconnect the ECS and apsaradb for Redis instances in different regions, you can use the redis-shake tool to migrate the apsaradb for Redis instance to the region where the ECS instance is located.
Procedure
- Log on to the ApsaraDB for Redis console.
- Add the internal IP address of the ECS instance to a whitelist of the apsaradb for Redis instance.
- Establish a ClassicLink connection.
- Test in the ECS instance to confirm that the connection is established.
The ECS instance in a VPC connects to the ApsaraDB for Redis instance in a classic network
See the following document for details.
Application scope
- ApsaraDB for Redis