An Elastic Compute Service (ECS) instance and an ApsaraDB RDS instance can communicate over an internal network only when the instances reside in the networks of the same type. You can change the network types of the instances to the same network type or use a Cloud Enterprise Network (CEN) instance to connect the instances over an internal network.
Check network types
Make sure that the ECS instance and the RDS instance both reside in VPCs or in the classic network.
View the network type of the ECS instance.
View the network type of the RDS instance.
If one instance resides in the classic network and the other instance resides in a VPC, use one of the following methods to resolve the issue:
Methods suitable in scenarios in which the ECS instance resides in a VPC and the RDS instance resides in the classic network:
Method 1: Migrate the RDS instance from the classic network to the VPC in which the ECS instance to be connected resides. We recommend that you use this method. For more information, see Change the network type.
Method 2: Purchase an ECS instance that resides in the classic network. Take note that a VPC provides higher security than the classic network. We recommend that you use VPCs.
NoteECS instances cannot be migrated from VPCs to the classic network.
Method 3: Connect the ECS instance to the RDS instance by using the public endpoint of the RDS instance. This method delivers poor performance, security, and stability. For more information about how to apply for a public endpoint, see Apply for or release a public endpoint for an ApsaraDB RDS for MySQL instance, Apply for or release a public endpoint for an ApsaraDB RDS for SQL Server instance, Apply for or release a public endpoint for an ApsaraDB RDS for PostgreSQL instance, and Apply for or release a public endpoint for an ApsaraDB RDS for MariaDB instance.
Methods suitable in scenarios in which the ECS instance resides in the classic network and the RDS instance resides in a VPC:
Method 1: Migrate the ECS instance from the classic network to the VPC in which the RDS instance to be connected resides. You can click View Details to the right of the Network Type parameter to view the ID of the VPC in which the RDS instance resides. We recommend that you use this method. For more information, see Migrate an ECS instance.
Method 2: Change the network type of the RDS instance from VPC to classic network. Take note that a VPC provides higher security than the classic network. We recommend that you use VPCs.
Method 3: Use the ClassicLink feature to connect the classic network-type ECS instance to the VPC-type RDS instance over an internal network. For more information, see Enable ClassicLink.
NoteIf the instances cannot be connected after the ClassicLink feature is enabled, resolve the issue based on the descriptions in Troubleshoot connection issues between a classic network and a VPC after you establish a ClassicLink connection.
Method 4: Connect the ECS instance to the RDS instance by using the public endpoint of the RDS instance. This method delivers poor performance, security, and stability. For more information about how to apply for a public endpoint, see Apply for or release a public endpoint for an ApsaraDB RDS for MySQL instance, Apply for or release a public endpoint for an ApsaraDB RDS for SQL Server instance, Apply for or release a public endpoint for an ApsaraDB RDS for PostgreSQL instance, and Apply for or release a public endpoint for an ApsaraDB RDS for MariaDB instance.
If the ECS instance and the RDS instance both reside in VPCs, make sure that the instances reside in the same VPC.
View the ID of the VPC in which the ECS instance resides.
View the network type of the RDS instance.
If the ECS instance and the RDS instance reside in different VPCs, use one of the following methods to resolve the issue:
Method 1: Migrate the RDS instance to the VPC in which the ECS instance resides. We recommend that you use this method. For more information, see Change the VPC and vSwitch.
Method 2: Create a Cloud Enterprise Network (CEN) instance to establish a connection between the two VPCs. For more information about CEN, see Use CEN to enable intra-region network communication.
Method 3: Connect the ECS instance to the RDS instance by using the public endpoint of the RDS instance. This method delivers poor performance, security, and stability. For more information about how to apply for a public endpoint, see Apply for or release a public endpoint for an ApsaraDB RDS for MySQL instance, Apply for or release a public endpoint for an ApsaraDB RDS for SQL Server instance, Apply for or release a public endpoint for an ApsaraDB RDS for PostgreSQL instance, and Apply for or release a public endpoint for an ApsaraDB RDS for MariaDB instance.
If the ECS instance and the RDS instance reside in the same VPC and the same region, the ECS instance can connect to the RDS instance by using the public endpoint rather than the internal endpoint of the RDS instance, and both the ping and telnet commands return connection failures, you can resolve the issue based on the descriptions in What do I do if an ECS instance cannot connect to an ApsaraDB RDS instance due to routing problems?