All Products
Search
Document Center

ApsaraDB RDS:Quickly create and use an ApsaraDB RDS for SQL Server instance

Last Updated:Mar 28, 2026

This tutorial walks you through creating an ApsaraDB RDS for SQL Server instance, setting up a database and account, and connecting to it — all from scratch. By the end, you'll have a running SQL Server instance you can query.

Before diving in, review the limits of ApsaraDB RDS for SQL Server if you're new to the service.

Prerequisites

Before you begin, ensure that you have:

  • An Alibaba Cloud account

  • (RAM users only) The AliyunRDSFullAccess and AliyunBSSOrderAccess policies attached to your Resource Access Management (RAM) user — see Use RAM for resource authorization

Billing

Creating an instance charges you for the instance type and storage. Fees depend on the billing method, edition, instance type, storage class, and storage capacity.

To avoid unexpected charges after completing this tutorial, release pay-as-you-go instances you no longer need.

Step 1: Create an instance

  1. Go to the ApsaraDB RDS instance creation page.

  2. Select a Billing Method. > Tip: Start with Pay-as-you-go and convert to subscription once your requirements are finalized.

    Billing methodBest forKey benefit
    Pay-as-you-goTesting, short-term, or unpredictable workloadsBilled hourly; release the instance at any time
    SubscriptionLong-term, stable workloadsLower cost; significant discounts for longer durations
  3. Select a Region.

    Important

    The region cannot be changed after the instance is created. Select the same region as your ECS instances to enable internal network connectivity and minimize latency.

    - Internal network access requires the RDS instance and ECS instance to be in the same region and VPC. - To connect from an on-premises device, select the region geographically closest to you. Add a public endpoint later.
  4. Select the Database Engine, Edition, and Storage Type. Database engine: Select Microsoft SQL Server. Supported versions: 2012, 2016, 2017, 2019, and 2022. Edition: Choose based on your availability and scalability needs. > Tip: Not sure which edition to pick? Use the High-availability Edition for production and the Basic Edition for development or testing. Storage type: Use Enterprise SSDs (ESSDs) for high performance — see Storage types. Enable Cloud Disk Encryption for enhanced data security — see Disk encryption.

    EditionArchitectureBest for
    Basic EditionSingle-node; compute decoupled from storage; no read-only instancesDev/test or non-critical workloads. Longer recovery time during failures.
    High-availability Edition (Recommended)Primary + secondary with automatic failover; secondary is standby-onlyProduction environments requiring HA. Covers ~80% of use cases.
    Cluster Edition (Recommended)Primary + readable secondary with automatic failover; supports 1–7 read-only instancesWorkloads requiring HA and read scaling.
  5. Configure network settings. The Network Type defaults to VPC.

    • VPC: Select the VPC where your application (ECS) resides. > Note: Instances must be in the same VPC to communicate over the internal network. They can reside in different vSwitches within that VPC.

    • Add to whitelist: Select Yes (recommended) to automatically add the VPC CIDR block to the RDS whitelist, enabling internal access from ECS instances in this VPC. > Note: If you select No, set the whitelist manually after the instance is created.

  6. Select the zone, vSwitch, and Deployment Method.

    • Zone: A physical location within a region. Performance differences between zones in the same region are negligible. Placing your ECS and RDS instances in the same zone minimizes network latency, though cross-zone latency is negligible for most workloads.

    • vSwitch: A logical subnet within a VPC. Select an existing vSwitch or click Create vSwitch — see Create and manage a vSwitch.

    • Deployment method:

      • Multi-zone deployment (Recommended): Primary and secondary nodes in different zones. Configure zone and network settings for both nodes separately. Provides cross-zone disaster recovery.

      • Single-zone deployment: Both nodes in the same zone. Lower replication latency, but no cross-zone redundancy. Basic Edition supports single-zone deployment only.

    If a zone is sold out, select a different zone.
  7. Select an Instance Type.

    • Category: Availability varies by region and edition; the console shows only options available for your configuration.

      CategoryResourcesBest for
      General-purposeDedicated memory and I/O; shared CPU and storageBalanced workloads requiring cost efficiency
      DedicatedCPU, memory, storage, and I/O all dedicatedProduction workloads requiring consistent, predictable performance. Not available for the Basic Edition.
      SharedDedicated memory and storage; shared CPUEntry-level applications or development environments
    • Instance type: Select a specific type by CPU cores, memory, maximum connections, and other specifications. For a full list, see Primary instance types.

  8. Select a Storage Capacity in increments of 5 GB. This capacity covers data, system files, transaction logs, and temporary files.

    Local SSD capacity is tied to the instance type. ESSDs and standard SSDs support independent capacity scaling.
  9. (Subscription only) Set the Subscription Duration in the upper-right corner. Longer durations offer lower prices — hover over View Details next to Price for a breakdown.

  10. (Optional) Configure additional parameters.

    ParameterDescription
    PortCustom database port. Default: 1433. Range: 1000–5999.
    Release ProtectionPay-as-you-go only. Prevents accidental instance termination — see Enable or disable release protection.
    Resource GroupLogical grouping for permission management and billing.
    Instance NameCustom name to identify the instance.
    Character Set Collation RuleDefault: Chinese_PRC_CI_AS. Can be modified after creation.
    TagsAdd tags for categorized management — see Filter instances by tag.
    Privileged AccountThe superuser account. Configure now or create it later. Each instance supports only one privileged account, and it cannot be deleted.
  11. In the upper-right corner, set the Quantity. The default is 1; you can purchase up to 20 instances at a time.

  12. Review the order and click Confirm Order to complete the payment.

    For subscription instances, check Enable Auto-renewal to prevent service interruptions at expiration. The auto-renewal cycle matches your purchase cycle — monthly or yearly. For details, see Renew an expired resource. To configure auto-renewal settings, see Auto-renewal.
  13. Go to the Instances list and select the region you created the instance in. Provisioning typically takes 1–10 minutes. Refresh the page to check the status.

1. Quickly create an RDS SQL Server instance

This tutorial describes how to use the Quick Creation method to create an RDS SQL Server instance in the console. Unlike the Standard Creation method, the Quick Creation method lets you create an instance by configuring only the key parameters. This method is designed to help you get started quickly. For more information about how to configure other parameters when you create an instance, see Create an RDS SQL Server instance.

  1. Go to the RDS Management Console and click Create Instance. The RDS instance purchase page opens.

  2. At the top of the purchase page, select Quick Creation.

  3. Select Billing Method. RDS for SQL Server offers two billing methods. The scenarios and features of each method are as follows:

    Billing Method

    Scenario

    Benefits

    Subscription

    Long-term use of an ApsaraDB RDS for SQL Server instance.

    The subscription billing method is more cost-effective than the pay-as-you-go billing method. The longer the subscription duration, the higher the discount.

    Pay-as-you-go

    Short-term use of an ApsaraDB RDS for SQL Server instance.

    You can release the instance at any time to stop billing.

    Alternatively, you can create a Pay-as-you-go instance. After you confirm that the instance meets your requirements, you can change the billing method from pay-as-you-go to subscription.

  4. Select the Region in which to create the RDS instance.

    Important

    You cannot change the region after you purchase an RDS instance. Choose the region carefully.

    • If you have purchased an Elastic Compute Service (ECS) instance and want the ECS instance to connect to the RDS instance over an internal network, select the same region as the ECS instance. Otherwise, the ECS instance can access the RDS instance only over the public network, which prevents optimal performance.

    • If you want to connect to the RDS instance from a device other than an ECS instance, such as a local server or computer, create the RDS instance in a region close to that device to reduce network latency. You can then connect to the RDS instance using its public endpoint.

  5. Select Engine. This tutorial demonstrates the steps using a SQL Server database.

  6. Select an Instance Type.

    RDS SQL Server offers a variety of instance types that you can select as needed. If an instance type does not meet your needs, you can change the configuration after the instance is created or select Standard Creation at the top of the page to create a custom instance. For more information, see Create an RDS SQL Server instance.

  7. (Optional) If you set Billing Method to Subscription, specify a Subscription Duration in the upper-right corner of the page.

    Alibaba Cloud provides lower prices for longer subscription durations. Move your pointer over View Details next to the Price field to see pricing details.

  8. Set the network and vSwitch. The network type is set to Virtual Private Cloud (VPC) by default.

    Important
    • If the VPC is the same but the vSwitch is different, the ECS instance and the RDS instance can still communicate over the internal network.

    • You cannot change the VPC after the instance is created. To connect to the RDS instance from an ECS instance over an internal network, make sure they are in the same region and use the same VPC.

  9. (Optional) View additional configuration items. In Quick Creation mode, Alibaba Cloud automatically configures other parameters by default. You can click More Configurations (Optional) to view these settings.

  10. Select the Quantity of instances. The Quick Creation feature lets you purchase up to 10 instances at a time. For this tutorial, the default value is 1.

  11. (Optional) If you set the Billing Method to Subscription, you must also set the Duration.

    You can also select Enable Auto-renewal to prevent service interruptions due to expiration.

  12. Click Confirm Order and proceed to payment.

  13. To view the instance, go to the Instance List page. At the top of the page, select the region where the instance is located and find the instance by its Creation Time.

    Note

    You can go to the Task Hub page to view the instance creation progress. It takes about 1 to 10 minutes to create an instance. After the instance is created, refresh the Instances page to view it.

Step 2: Create a database

  1. Go to the ApsaraDB RDS instances list. Select the region, then click the instance ID.

    image

  2. In the left navigation pane, click Database Management, then click Create Database.

  3. Set the database parameters. For this tutorial, set Database Name to dbtest and Supported Character Set to Chinese_PRC_CI_AS. Click Create.

    image

  4. The new database appears on the Database Management page, and is also visible after connecting to the instance.

    image

Step 3: Create an account

  1. On the instance details page, click Accounts in the left navigation pane.

  2. Click Password Policy to set the password validity period and strengthen account security.

    Click to view the configuration example for this tutorial

    To require password changes every 90 days and ensure that new passwords are used for at least 30 days, set Maximum Password Age to 90 days and Minimum Password Age to 30 days.

    Shared instances do not support custom password policies. This restriction also applies to Serverless instances. Skip this step for those instance types.

    image

  3. Click Create Account. In the panel, fill in the account details.

    • Database Account: Enter testuser for this tutorial.

    • Account Type: RDS for SQL Server supports Privileged Account, Standard Account, and Super Privileged Account. This tutorial uses a Privileged Account. For other types, see Account types and permissions. > Important: The first account on an instance must be a privileged account, and each instance supports only one. This account has read and write permissions for all databases on the instance. If creation fails, a privileged account may already exist — see Modify account permissions.

    • New Password and Confirm Password: Enter your password.

    • Apply the password policy from step 2 to this account.

    An error occurs if the account name is a duplicate, or if you create accounts faster than the previous creation completes. Check for duplicate names or wait before retrying.

    image

  4. Click OK.

  5. Refresh the Accounts page to confirm the privileged account appears.

    image

Step 4: Configure secure access

Skip this step if you plan to connect using DMS — DMS does not require whitelist configuration. If you plan to connect using SSMS or a Java application, complete this step first.

Set an IP whitelist

  1. On the instance details page, click Whitelist and SecGroup in the left navigation pane.

  2. Click Create Whitelist, enter a Group Name, and add your application server's IP address.

    Click to view how to obtain common IP addresses

    ScenarioIP to addHow to obtain
    ACK cluster with Flannel pluginNode IP of the application podView on the pod page of the target ACK cluster
    ACK cluster with Terway pluginPod IP of the applicationView on the pod page of the target ACK cluster
    ECS instance (internal network access)Private IP of the ECS instanceGo to the ECS console, select the region, and view the private IP address. image
    ECS instance (no internal network access)Public IP of the ECS instanceGo to the ECS console, select the region, and view the public IP address.
    On-premises devicePublic IP of the deviceSearch for your IP using a search engine. >
    Note

    This method may return an inaccurate result. See other methods.

    image

  3. Click OK.

  4. Refresh the Whitelist and SecGroup page to confirm the whitelist entry.

    image

Get the connection endpoint

Depending on your setup, use the internal or public endpoint.

Important

Internal network access requires both of the following conditions:

  • Your server is on Alibaba Cloud and is in the same region and same network type as the RDS instance.

  • If the network type is VPC, the server and RDS instance must share the same VPC ID.

ScenarioEndpoint to useHow to obtain
Meets internal network access conditionsInternal endpointOn the instance details page, click Database Connection in the left navigation pane to view the internal address and port. image >
Note

The public endpoint appears only after you click Enable Public Endpoint.

ECS instance without internal access, or on-premises devicePublic endpointClick Enable Public Endpoint on the Database Connection page to generate a public endpoint.

Step 5: Connect to the instance

Choose the connection method that fits your setup. If you're evaluating the service, DMS is the fastest way to get started — no whitelist setup required.

Method 1: Connect using DMS

Data Management (DMS) is Alibaba Cloud's one-stop data management platform. It provides database design, development, data integration, and governance features. DMS connects to an RDS instance without requiring an IP whitelist or a specific connection endpoint.

  1. Go to the Instances page. Select the region, then click the instance ID.

  2. Click Log On to Database to open the DMS login page.

    image..png

  3. In the Log on to Instance dialog, fill in the login details and click Log on.

    • Access Mode: Select Account and Password Logon.

    • Database Account: Enter testuser.

    • Database Password: Enter the password you set in step 3.

    • Control Mode: Select Flexible Management for this tutorial.

    Flexible Management is free. Stable Change and Security Collaboration incur fees but offer more features and tighter database control — see Control modes.

    image

  4. After logging in, the dbtest database appears in the Logged-in Instances list on the left. Double-click another database to switch to it.

    If the database doesn't appear: - Missing permissions: Go to Accounts on the instance details page, find the account, and click Change Permissions to grant access. - Metadata not synced: Hover over the instance name and click the image refresh button to reload the database list.

    image

  5. Use the SQL Console to create tables, run queries, and manage your data. To verify the connection is working, run:

    SELECT @@VERSION;

    The query returns the SQL Server version string, confirming a successful connection.

Method 2: Connect using SSMS

Microsoft SQL Server Management Studio (SSMS) is a graphical tool for managing SQL Server databases. This tutorial uses SSMS 19.0 as an example.

Download the latest SSMS version to support all SQL Server versions.
Complete step 4 before proceeding — SSMS requires an IP whitelist entry and a connection endpoint.
  1. Open SSMS.

  2. Click Connect > Database Engine.

  3. Enter the connection details in the Connect to Server dialog.

    ParameterValue for this tutorialDescription
    Server namerm-2ze****.rds.aliyuncs.com,1433The instance endpoint and port, separated by a comma. Use the public or internal endpoint obtained in step 4.
    AuthenticationSQL Server Authentication
    Login nametestuser
    PasswordYour account password
  4. Click Connect. After a successful connection, the instance and its databases appear in the Object Explorer on the left. To verify the connection, run the following query in a new query window:

    SELECT @@VERSION;

    The query returns the SQL Server version string, confirming a successful connection.

Method 3: Connect using Java (JDBC)

All examples use the Microsoft JDBC driver to connect from a Java application to an ApsaraDB RDS for SQL Server instance.

Complete step 4 before proceeding — add the IP address of your application's runtime environment (ECS instance or on-premises device) to the whitelist. See Set a whitelist.

1. Add the Microsoft JDBC driver.

Option A: Maven dependency (recommended)

Option A: Maven dependency (recommended)

Add the following to your pom.xml:

<dependency>
  <groupId>com.microsoft.sqlserver</groupId>
  <artifactId>mssql-jdbc</artifactId>
  <version>12.2.0.jre8</version> <!-- Check for the latest version -->
</dependency>
Match the driver version to your Java version — for example, mssql-jdbc-12.2.0.jre8.jar requires Java 8 or later. For version history, see the Maven Central repository.

After adding the dependency, sync your Maven project to download it automatically.

imageimageimage

Option B: Manual JAR

Option B: Manual JAR

  1. Download the driver that matches your Java version from Microsoft JDBC Driver for SQL Server.

  2. After downloading and extracting the archive, add the JAR file (such as sqljdbc4.jar or sqljdbc.jar) to your project's classpath. The following screenshots use IntelliJ IDEA as an example:

    image

    image

    image

2. Connect to the database.

Replace the placeholder values with your actual endpoint and database name. Store credentials in environment variables rather than hardcoding them. For how to find the endpoint, see View or change the endpoint and port number.

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class SqlServerConnection {

    public static void main(String[] args) {
        // Use the internal endpoint if the application runs on ECS in the same VPC.
        // Use the public endpoint for on-premises or external environments.
        String url = "jdbc:sqlserver://rm-2vc367d081200******.mssql.cn-chengdu.rds.aliyuncs.com:1433;"
                + "database=<your-database-name>;"
                + "encrypt=true;"
                + "trustServerCertificate=true;"
                + "loginTimeout=30;";
        // Read credentials from environment variables to avoid hardcoding sensitive values.
        String username = System.getenv("RDS_USERNAME");
        String password = System.getenv("RDS_PASSWORD");

        Connection connection = null;

        try {
            // Load the JDBC driver.
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

            // Connect to the instance.
            connection = DriverManager.getConnection(url, username, password);
            System.out.println("Connection successful!");

            // Run a test query to verify the connection.
            Statement statement = connection.createStatement();
            ResultSet resultSet = statement.executeQuery("SELECT @@VERSION");

            if (resultSet.next()) {
                System.out.println("SQL Server version: " + resultSet.getString(1));
            }

            resultSet.close();
            statement.close();

        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            if (connection != null) {
                try {
                    connection.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

3. Run the code.

Before running, set the environment variables:

export RDS_USERNAME=testuser
export RDS_PASSWORD=<your-password>

Save the file as SqlServerConnection.java, then compile and run it from the command line or your IDE. A successful connection produces output similar to:

image

What's next

Appendix: Quick start video guide

RDS SQL Server快速入门-中国站.mp4

FAQ

How do I view the total number of RDS instances in my account?

Log in to the ApsaraDB RDS console and go to the Overview page. It shows the total instance count by database engine, the regions where your instances are deployed, and how many are running in each region.

image

After creating an instance, why can't I find it in the console?

The most common reason is that you're looking in the wrong region — check the region selector in the top navigation bar and switch to the region where you created the instance.

If the region is correct, the instance may have failed to provision. This usually happens when the selected zone lacks sufficient resources. Go to the Orders page in the Billing Management console to check if a refund was issued, then try again in a different zone.

Another possibility: if your account uses a RAM policy that blocks unencrypted instance creation, the instance cannot be created if you use local disks (which don't support cloud disk encryption) or if you use cloud disks without enabling encryption. To resolve this, select a standard SSD or ESSD storage type, enable Cloud Disk Encryption, configure the key, and try again — see Use RAM policies to manage RDS permissions.

References