All Products
Search
Document Center

ApsaraDB for Redis:Connect an ECS instance to an ApsaraDB for Redis instance in different types of networks

Last Updated:Jun 17, 2024

This topic describes the methods used to connect an Elastic Compute Service (ECS) instance to an ApsaraDB for Redis instance when they are deployed in different types of networks. For example, when an ECS instance is deployed in the classic network and an ApsaraDB for Redis instance resides in a virtual private cloud (VPC), you can connect them by using the methods described in this topic.

Prerequisites

The ECS instance and the ApsaraDB for Redis instance are deployed in the same region.

Network types

Network type

Description

VPC (recommended)

A VPC is a private network dedicated to your Alibaba Cloud account. VPCs are logically isolated from each other to provide higher security and performance. If a Redis client is deployed on an ECS instance, you can connect the client to an ApsaraDB for Redis instance over a VPC for higher security and lower network latency.

Classic network

Cloud services on the classic network are not isolated. Unauthorized access can be blocked only by using security groups or whitelists.

For more information about internal network types, see Network types.

Note

In addition to connections over an internal network, ApsaraDB for Redis instances also support connections over the Internet. For more information, see Use a public endpoint to connect to an ApsaraDB for Redis instance.

Connect an ECS instance located in a VPC to an ApsaraDB for Redis instance located in the classic network

  1. Log on to the ECS console.

  2. In the left-side navigation pane, choose Instances & Images > Instances.

  3. In the top navigation bar, select the region in which the instance is deployed.
  4. On the Instances page, click the ID of the ECS instance that you want to use.

  5. In the Configuration Information section, obtain the ID of the VPC to which the ECS instance belongs.

  6. Switch the ApsaraDB for Redis instance to the VPC to which the ECS instance belongs. For more information, see Switch the network type from classic network to VPC.

    Note

    The network type can be switched from classic network to VPC but not from VPC to classic network.

Connect an ECS instance located in the classic network to an ApsaraDB for Redis instance located in a VPC

  1. Log on to the ApsaraDB for Redis console and go to the Instances page. In the top navigation bar, select the region in which the instance is deployed. Then, find the instance and click its ID.
  2. In the Basic Information section, obtain the ID of the VPC to which the ApsaraDB for Redis instance belongs.

  3. Select one of the following methods to achieve network interconnection based on your business requirements:

    • Migrate the ECS instance to the VPC to which the ApsaraDB for Redis instance belongs. We recommend that you use this method. For more information, see Migrate an ECS instance from a classic network to a VPC.

    • Use ClassicLink to connect the ECS instance to the VPC to which the ApsaraDB for Redis instance belongs. For more information, see Connect an instance in a classic network to a VPC.

      Note
      • When you configure security group rules of ClassicLink, you must set the protocol to Custom TCP and the port range to 6379/6379.

      • The ClassicLink-based interconnection solution is a temporary workaround. In production environments that require high-speed connections, we recommend that you migrate the ECS instance to the VPC to which the ApsaraDB for Redis instance belongs.

What to do next

Select one of the following connection methods based on your business requirements: