All Products
Search
Document Center

:How can an ECS instance access an RDS instance that is under another account?

Last Updated:May 10, 2023

Overview

This article describes how to connect an ECS instance to an RDS instance that is owned by another account.

Background information

By default, the ECS and RDS instances under different accounts cannot communicate with each other through the internal network. You can use the following methods to access the RDS instances that are owned by another account. We recommend that you use method 1.

Method 1: Migrate the RDS instance to the Alibaba Cloud account to which the ECS instance belongs

Follow these steps:

  1. Purchase an RDS instance by using the Alibaba Cloud account to which the ECS instance belongs. For more information, see purchase an RDS instance.

  2. Migrate data from the original RDS instance to the new RDS instance. For more information, see migrate data between RDS instances.

  3. The original RDS instance is released.

Method 2: Cloud Enterprise Network or VPN Gateway

To keep the ECS and RDS instances under different Alibaba cloud accounts, perform the following steps:

  1. Make sure that the network type of the ECS instance and RDS instance is VPC.

    1. If the network type of the ECS instance is classic network, you need to migrate it to VPC. For more information, see migrate to VPC.

    2. If the network type of the RDS instance is classic network, you must switch it to VPC. For more information, see switch to VPC.

  2. Create an account between two VPCs cloud Enterprise Network or VPN Gateway.

Method 3: public network access

Access RDS through the Internet instead of the intranet. For more information, see how to connect to RDS.

Application scope

  • ApsaraDB RDS for MySQL

  • ApsaraDB RDS for SQL Server

  • ApsaraDB RDS for PostgreSQL