You can establish ClassicLink connections to allow Elastic Compute Service (ECS) instances in a classic network to communicate with resources in a virtual private cloud (VPC) over private IP addresses. You can establish ClassicLink connections in scenarios such as during a transition from a classic network to a VPC and when resources in a classic network need to communicate with resources in a VPC over private IP addresses. This topic describes how to connect an instance in a classic network to a VPC by using ClassicLink.
Background information
The ClassicLink feature of Alibaba Cloud allows you to establish private connections between Alibaba Cloud classic networks and VPCs. Classic networks and VPCs are two types of networks on Alibaba Cloud. By default, classic networks are isolated from VPCs. You can use the ClassicLink feature to connect classic networks to VPCs. This way, resources in the classic networks can communicate with resources in the VPCs. For more information, see Overview of ClassicLink.
Limits
Before you use the ClassicLink feature, take note of the following limits:
Procedure
Step 1: Enable the ClassicLink feature
Log on to the VPC console.
In the top navigation bar, select the region and resource group to which the resource belongs.
In the list of VPCs, find the VPC to which you want to connect and click the ID of the VPC.
On the Basic Information tab, click Enable ClassicLink in the upper-right corner.
In the Enable ClassicLink message, click OK.
Step 2: Add a ClassicLink security group rule
Log on to the ECS console.
In the left-side navigation pane, choose .
In the top navigation bar, select the region and resource group to which the resource belongs.
Add a ClassicLink rule to a security group of an ECS instance that resides in a classic network.
Find the ECS instance that resides in the classic network. In the Actions column, choose .
In the dialog box that appears, select the VPC to which you want to connect the instance and click Confirm.
Note
You can call the AttachClassicLinkVpc API operation to link an instance that is deployed in the classic network to a VPC by establishing a ClassicLink connection between the instance and the VPC.
Click Go to the instance security group list and add ClassicLink rules.

Find a security group of the ECS instance. In the Actions column, click Add Rules.
On the Security Group Rules page, click Add ClassicLink Rule in the upper-right corner. In the dialog box that appears, configure the parameters that are described in the following table.
Parameter | Description |
Classic Security Group | The name of the classic-network security group is displayed. |
Select VPC | The VPC to which to connect the instance. |
VPC-type Security Groups | The security groups from the selected VPC that you want to associate with the instance. You can select up to five security groups. |
Mode | The access mode. Classic Network <=> VPCs (recommended): allows mutual access between resources in the classic network and resources in the VPC. Classic Network => VPCs: allows resources in the classic network to access resources in the VPC. VPCs => Classic Network: allows resources in the VPC to access resources in the classic network.
|
Protocol | The communication protocol. Example: Custom TCP. |
Port Range | The port range. Specify a port range in the <Start port number>/<End port number> format. Example: 80/80, which indicates port 80. |
Priority | The priority of the rule. A smaller value indicates a higher priority. Example: 1. |
Description | The description of the rule. |
Click OK.
Step 3: Test the connectivity between the instance and the VPC
Perform the following steps to test the connectivity between the instance and the VPC:
Log on to the ECS console.
In the left-side navigation pane, choose .
In the top navigation bar, select the region and resource group to which the resource belongs.
View the Network Type column of the ECS instance.
If the ECS instance in the classic network is connected to the VPC, the connection status is Connected.