Updated on 2024-10-24 GMT+08:00

Connecting to a DB Instance from a Windows Server

If you cannot access your DB instance through a floating IP address, bind an EIP to the DB instance and connect to it through the EIP.

You can connect to an instance through a non-SSL connection or an SSL connection using SQL Server Management Studio. The SSL connection encrypts data and is more secure.

For details about how to connect to a DB instance with SSL disabled, see Connecting to a DB Instance from a Windows Server.

Step 1: Test Connectivity and Install SQL Server Management Studio

  1. On the Instances page of the RDS console, click the DB instance name to go to the Overview page.
  2. Obtain the EIP and database port of the DB instance.
    Figure 1 Connection information

    If no EIP has been bound to the DB instance, see Binding and Unbinding an EIP.

  3. Open the cmd window on your local server and check whether the EIP and database port of the DB instance can be connected.

    telnet EIP 1433

    • If yes, network connectivity is normal.
    • If no, check the security group rules.
      If in the security group of the DB instance, there is no inbound rule with Source set to 0.0.0.0/0 and Protocol & Port set to All, add an inbound rule for the EIP and port of the DB instance. For details, see Configuring Security Group Rules.
      Figure 2 DB instance security group
  4. Open a browser on the local server, visit the Microsoft website, and download the installation package, for example, SQL Server Management Studio 18.0.
  5. Double-click the installation package and complete the installation as instructed.

Step 2: Connect to the DB Instance Using SQL Server Management Studio

  1. On the Instances page of the RDS console, click the DB instance name to go to the Overview page.
  2. Click Download under SSL to download Certificate Download.zip, and extract the root certificate ca.pem and bundle ca-bundle.pem from the package.
    Figure 3 Downloading a certificate
    • Replace the old certificate before it expires to improve system security.
    • Replacing a certificate requires you to contact customer service to apply for permissions. After being granted the permissions, you can click Replace Certificate under SSL and then click OK in the displayed dialog box.
    • After you bind an EIP to a DB instance, you must reboot the instance for the SSL connection to take effect.
  3. Upload the root certificate ca.pem to the ECS. For details, see How Can I Import the Root Certificate to a Windows or Linux OS?
  4. Start SQL Server Management Studio.
  5. Choose Connect > Database Engine. In the displayed dialog box, enter login information.
    Figure 4 Connecting to the server
    Table 1 Parameter description

    Parameter

    Description

    Server name

    EIP and database port obtained in 2.

    Authentication

    Authentication mode. Select SQL Server Authentication.

    Login

    Name of the account used to access the DB instance. The default value is rdsuser.

    Password

    Password of the account.

  6. Click Options. On the Connection Properties page, enter related parameters and select Encrypt connection to enable SSL encryption. (By default, Encrypt connection is not selected. You need to select it manually.)
    Figure 5 Connection properties
  7. Click Connect to connect to the DB instance.

Follow-up Operations

After logging in to the DB instance, you can create or migrate databases.