After you complete the initial configuration for an ApsaraDB RDS for SQL Server instance, you can connect to the RDS instance by using various methods such as Data Management (DMS) and Microsoft SQL Server Management Studio (SSMS) to perform the required operations. This topic describes how to connect to an RDS instance by using these connection methods.
Prerequisites
An RDS instance is created. For more information, see Create an ApsaraDB RDS for SQL Server instance.
A database is created in the RDS instance, and an account is created for the database. For more information, see Create accounts and databases.
An IP address whitelist is configured for the RDS instance. This way, you can connect to the RDS instance from the Elastic Compute Service (ECS) instance on which a client is deployed or from an on-premises device. For more information, see Configure an IP address whitelist for an ApsaraDB RDS for SQL Server instance.
NoteIf you want to connect an ECS instance to the RDS instance over an internal network, make sure that these instances reside in the same virtual private cloud (VPC), and the private IP address of the ECS instance is added to an IP address whitelist of the RDS instance.
If you want to connect an on-premises device to the RDS instance, make sure that the public IP address of the on-premises device is added to an IP address whitelist of the RDS instance.
Procedure
Use DMS to connect to an RDS instance
DMS offers an integrated solution that supports data management, schema management, server management, user authorization, security audit, trend analysis, data tracking, business intelligence (BI) reporting, and performance analysis and optimization. For more information about DMS, see What is DMS?
- Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
On the Basic Information page, click Log On to Database.
In the Log on to Database Instance dialog box of the DMS console, enter the username and password of the account that is used for logon and click Login.
NoteThe account that is used for logon must have permissions on the required database. Otherwise, the required database is not displayed in the left-side navigation pane.
Refresh the page. In the left-side navigation pane of the DMS console, click Instances Connected to view databases that are created for the RDS instance.
NoteIf you cannot find the database that you created on the Instances Connected page, the permissions on the database are not granted to the account that you use to log on to the DMS console. In this case, you can go to the Accounts page of the RDS instance, find the account, and then click Change Permissions in the Actions section to grant the permissions.
You can also log on to the DMS console and add your RDS instance to DMS. Then, you can switch to the specified database of your RDS instance in the DMS console. For more information, see Register an ApsaraDB instance.
Use the SSMS client to connect to an RDS instance
SSMS is a GUI tool that enables you to manage and handle SQL Server databases. SSMS can be used to connect to different SQL Server databases such as RDS instances, on-premises SQL Server instances, and instances that run SQL Server in other clouds. This section provides an example on how to use SSMS 19.0
to connect to an RDS instance.
We recommend that you download the latest version of SSMS to support all SQL Server versions.
Start the SSMS 19.0 client.
Choose Connect > Database Engine.
In the Connect to Server dialog box, configure the parameters that are required for the logon.
Parameter
Example value
Description
Server name
rm-2ze****.rds.aliyuncs.com,1433
The endpoint and port number of the RDS instance. Enter the public endpoint and public port number obtained when you apply for the public endpoint. Separate the endpoint and port number with a comma (,).
Authentication
SQL Server Authentication
The authentication mode of SQL Server.
Login
testuser
The username of the account for the RDS instance.
Password
Test_pw123
The password of the account for the RDS instance.
Click Connect.
After the connection is successful, the connection information is displayed on the left side of SSMS.
Use a host account to connect to an RDS instance
ApsaraDB RDS for SQL Server allows you to create host accounts. You can create a host account and use it to log on to the host on which your RDS instance is deployed. This helps manage your RDS instance in a more convenient way. For more information, see Create a host account for an ApsaraDB RDS for SQL Server instance and use the host account for logons.
FAQ
How do I use Function Compute to obtain data from my RDS instance?
You can install third-party dependencies on Function Compute. Then, you can obtain data from your RDS instance by using the built-in modules that are provided by the third-party dependencies in Function Compute. For more information, see Install third-party dependencies on Function Compute.