Menu
Amazon Relational Database Service
User Guide (API Version 2014-10-31)

Connecting to a DB Instance Running the Microsoft SQL Server Database Engine

Once Amazon RDS provisions your DB instance, you can use any standard SQL client application to connect to the instance. In order for you to connect, the DB instance must be associated with a security group containing the IP addresses and network configuration that you will use to access the DB instance. You may have already done this when you created the instance. If you assigned a default, non-configured security group when you created the instance, the DB instance firewall will prevent connections.

If you need to create a new security group to enable access, the type of security group you create will depend on what Amazon EC2 platform your DB instance is on, and whether you will be accessing your DB instance from an Amazon EC2 instance. For more information about the two Amazon EC2 platforms supported by Amazon RDS, EC2-VPC and EC2-Classic, see Determining Whether You Are Using the EC2-VPC or EC2-Classic Platform. In general, if your DB instance is on the EC2-Classic platform, you will need to create a DB security group; if your DB instance is on the EC2-VPC platform, you will need to create a VPC security group. For more information about security groups, see Amazon RDS Security Groups.

Once you have created the security group, you must modify the DB instance to associate it with the security group. For more information on modifying the DB instance, see Modifying a DB Instance Running the Microsoft SQL Server Database Engine.

You can enhance security by using SSL to encrypt connections to the DB instance. For information on connecting to a DB instance using SSL, see Microsoft SQL Server SSL Support.

The following examples assume that your DB instance has an appropriate security group.

Connecting with SQL Server Management Studio

This example shows how to connect to a DB instance running the Microsoft SQL Server database engine by using the Microsoft SQL Server Management Studio utility. For more information on using Microsoft SQL Server, go to the Microsoft SQL Server website.

Note

This example uses the Microsoft SQL Server Management Studio utility. This utility is part of the Microsoft SQL Server software distribution. To download a stand-alone version of this utility, go to the Microsoft Download Center - Microsoft SQL Server Management Studio Express.

To connect to a DB instance using Microsoft SQL Server Management Studio

  1. Sign in to the AWS Management Console and open the Amazon RDS console at https://console.aws.amazon.com/rds/.

  2. In the top right corner of the Amazon RDS console, select the region in which you want to create the DB instance.

  3. In the navigation pane, click Instances.

  4. On the Instances page of the AWS Management Console, choose the DB instance and then choose the Details tab. Note the server name and port number of the DB instance, which are displayed in the Endpoint field at the top of the panel, and the master user name, which is displayed in the Username field in the Configuration Details section. An example is shown following:

    
                        Locate DB instance server name and port
  5. Open Microsoft SQL Server Management Studio. The Connect to Server dialog box appears, as shown following:

    
                        Connect to Server dialog
  6. In the Server type: box, select Database Engine.

  7. In the Server name box, type or paste the endpoint and port number of the DB instance. Replace the colon ":" before the port number with a comma ",". For example, the Server name value could be: sqlsvr-pdz.abcd12340.us-west-2.rds.amazonaws.com,1433.

  8. In the Authentication box, select SQL Server Authentication.

  9. In the Login box, type or paste the master user name for the DB instance.

  10. In the Password box, type the password for the master user.

  11. Click Connect. After a few moments, Microsoft SQL Server Management Studio should be connected to your DB instance.

  12. Click New Query in the SQL Server Management Studio toolbar, as shown following:

    
                        Open a SQL query window

    A new SQL query window will open.

  13. Type the following SQL query:

    Copy
    select @@VERSION
  14. Click ! Execute on the SQL Enterprise Manager toolbar to run the query, as shown following:

    
                        Execute the query

    The query should return the version information for your DB instance, similar to the following:

    Copy
    Microsoft SQL Server 2012 - 11.0.2100.60 (X64) Feb 10 2012 19:39:15 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)

Connecting with SQL Workbench/J

This example shows how to connect to a DB instance running the Microsoft SQL Server database engine by using the SQL Workbench/J database tool. This tool uses JDBC for the connection.

Note

This example uses the SQL Workbench/J database tool. To download this tool, go to the SQL Workbench/J website. It also requires the JDBC driver for SQL Server. To download this driver, go to Microsoft JDBC Drivers 4.1 (Preview) and 4.0 for SQL Server.

This example illustrates the minimal profile settings for making a connection. For more information on additional SQL Workbench/J profile settings, go to Connecting to the database in the SQL Workbench/J documentation.

To connect to a DB instance using SQL Workbench

  1. Sign in to the AWS Management Console and open the Amazon RDS console at https://console.aws.amazon.com/rds/.

  2. In the top right corner of the Amazon RDS console, select the region in which you want to create the DB instance.

  3. In the navigation pane, click Instances.

  4. On the Instances page of the AWS Management Console, choose the DB instance and then choose the Details tab. Note the server name and port number of the DB instance, which are displayed in the Endpoint field at the top of the panel, and the master user name, which is displayed in the Username field in the Configuration Details section. An example is shown following:

    
                        Locate DB instance endpoint
  5. Open SQL Workbench/J. The Select Connection Profile dialog box appears, as shown following:

    
                        Select Connection Profile dialog
  6. In the first box at the top of the dialog box, enter a name for the profile.

  7. In the Driver box, select SQL JDBC 4.0.

  8. In the URL box, type in jdbc:sqlserver://, then type or paste the endpoint and port number used by the DB instance. For example, the URL value could be: jdbc:sqlserver://sqlsvr-pdz.abcd12340.us-west-2.rds.amazonaws.com:1433.

  9. In the Username box, type or paste the master user name for the DB instance.

  10. In the Password box, type the password for the master user.

  11. Click the save icon in the dialog toolbar, as shown following:

    
                        Save the profile
  12. Click OK. After a few moments, SQL Workbench/J should be connected to your DB instance.

  13. In the query pane, type the following SQL query:

    Copy
    select @@VERSION
  14. Click the execute icon in the toolbar, as shown following:

    
                        Execute the query

    The query should return the version information for your DB instance, similar to the following:

    Copy
    Microsoft SQL Server 2012 - 11.0.2100.60 (X64)

Troubleshooting a Connection to a DB Instance Running SQL Server

There are several common causes for problems when trying to connect to a DB instance:

  • The access rules enforced by your local firewall and the IP addresses you authorized to access your DB instance in the instance's security group are not in sync. The problem is most likely the egress or ingress rules on your firewall. For more information about security groups, see Amazon RDS Security Groups.

  • If you cannot send out or receive communications over the port you specified when you created the DB instance, you will not be able to connect to the DB instance. Check with your network administrator to determine if the port you specified for your DB instance is allowed to be used for inbound and outbound communication.

  • For newly created DB instances, you must wait for the DB instance status to be "Available" before you can connect to the instance. Depending on the size of your DB instance, it can take up to 20 minutes before the instance is available.

SQL Server Management Studio Error Messages

Try the following solutions to common error messages from SQL Server Management Studio.

  • Could not open a connection to SQL Server - Microsoft SQL Server, Error: 53 - Make sure you included the port number when you specified the server name. For example, the server name for a DB instance (including the port number) could be: sqlsvr-pdz.abcd12340.region.rds.amazonaws.com,1433.

  • No connection could be made because the target machine actively refused it - Microsoft SQL Server, Error: 10061 - You were able to reach the DB instance but the connection was refused. This is often caused by the user name or password being incorrect.

Related Topics