All Products
Search
Document Center

ApsaraDB RDS:How\ do\ I\ connect\ an\ ECS\ instance\ and\ an\ ApsaraDB\ RDS\ instance\ over\ an\ internal\ network\ if\ these\ instances\ reside\ in\ networks\ of\ different\ types\?\

Last Updated:Mar 28, 2026

ECS and RDS instances can communicate over an internal network only when both reside in the same network type. Identify your scenario below and follow the corresponding resolution.

Identify your scenario

ScenarioECS network typeRDS network type
Scenario 1VPCClassic network
Scenario 2Classic networkVPC
Scenario 3VPCVPC (different VPC)
Scenario 4VPCVPC (same VPC, connection still fails)

To check the network type of each instance, view the Network Type parameter on the instance details page in the console.

Scenario 1: ECS in VPC, RDS in classic network

Recommended: Migrate the RDS instance from the classic network to the Virtual Private Cloud (VPC) where the ECS instance resides. See Change the network type.

If migration is not feasible, use one of the following alternatives:

  • Purchase a new ECS instance in the classic network. Both instances then share the same network type. VPCs provide higher security than the classic network, so this is not a long-term recommendation.

    ECS instances cannot be migrated from a VPC to the classic network.
  • Connect via the RDS public endpoint. No network changes are required, but this delivers lower performance, security, and stability than an internal network connection. To apply for a public endpoint, see the instructions for your database engine:

Scenario 2: ECS in classic network, RDS in VPC

Recommended: Migrate the ECS instance from the classic network to the VPC where the RDS instance resides. To find the VPC ID, click View Details to the right of the Network Type parameter on the RDS instance details page. See Migrate an ECS instance.

If migration is not feasible, use one of the following alternatives:

Scenario 3: ECS and RDS in different VPCs

Recommended: Migrate the RDS instance to the VPC where the ECS instance resides. See Change the VPC and vSwitch.

If migration is not feasible, use one of the following alternatives:

Scenario 4: Same VPC, but ping and telnet fail

If the ECS and RDS instances are in the same VPC and the same region, but the ECS instance can only reach RDS via the public endpoint — and both ping and telnet return failures — the issue is likely caused by routing. See What do I do if an ECS instance cannot connect to an ApsaraDB RDS instance due to routing problems?