SQL Server Failover Cluster Instance on AWS

Partner Solution Deployment Guide

QS

August 2023
Sepehr Samiei and Garry Singh, AWS Microsoft Tech Specialist Solutions Architect team
Dave May, AWS Integration & Automation team

Refer to the GitHub repository to view source files, report bugs, submit feature ideas, and post feedback about this Partner Solution. To comment on the documentation, refer to Feedback.

This Partner Solution was created by Amazon Web Services (AWS). Partner Solutions are automated reference deployments that help people deploy popular technologies on AWS according to AWS best practices. If you’re unfamiliar with AWS Partner Solutions, refer to the AWS Partner Solution General Information Guide.

Overview

This guide covers the information you need to deploy the SQL Server Failover Cluster Instance Partner Solution in the AWS Cloud.

This Partner Solution is for IT infrastructure architects, database administrators, and DevOps professionals who plan to implement or extend Microsoft SQL Server (MSSQL) using SQL Server on AWS with Windows Server Failover Clustering (WSFC). Unlike the Partner Solution for SQL Server with Always On Replication, this one deploys an Always On Failover Cluster Instance (FCI). It also deploys Amazon FSx for Windows File Server as a network share to store the database files.

This guide does not provide general configuration and usage information for WSFC and MSSQL. For general guidance and best practices, consult the Microsoft product documentation and the Best Practices for Deploying Microsoft SQL Server on AWS whitepaper.

The SQL Server FCI Partner Solution deploys a highly available environment that includes Windows Server and SQL Server running on Amazon Elastic Compute Cloud (EC2). It requires shared storage that is accessible by all nodes within the WSFC cluster. It supports SQL Server 2019 running on Windows Server 2019.

This architecture uses a highly available Multi-AZ Amazon FSx file system as the network share used to store MSSQL database files. The Amazon FSx file system and EC2 Windows instances that host this architecture’s nodes are joined to the same Active Directory domain.

The "instance" in "failover cluster instance" means something different from the "instance" in "EC2 instance." In this Partner Solution, a failover cluster instance, or FCI, has the appearance of an instance of SQL Server running on a single computer. A failover cluster instance provides failover from one EC2 instance (WSFC node) to another if the current EC2 instance goes down. For an illustration, see Figure 1.

Traditionally, FCIs have been difficult to deploy and manage. With its Multi-AZ file system option, Amazon FSx provides fully managed file storage. This storage enables the high availability and durability that’s required to run business-critical Microsoft SQL Server database workloads without requiring licenses for each server. Amazon FSx automatically handles failover, simplifying shared storage to host your database deployments while reducing cost.

The automation in this deployment uses AWS Systems Manager Automation, AWS CloudFormation, and Windows PowerShell Desired State Configuration (DSC) to deploy a multi-node SQL Always On FCI. Windows Server Failover Clustering is a prerequisite for deploying an Always On FCI. MSSQL uses WSFC to increase application availability. WSFC provides infrastructure features that complement the high availability and disaster recovery scenarios supported in the AWS Cloud.

FCI, which was introduced with SQL Server 2008 as a high availability feature, continues to be available in all newer versions of MSSQL. When used on premises, SQL Server FCI is often used purely for high availability within a single data center. On AWS, you can use the SQL Server FCI Partner Solution to cover both high availability and disaster recovery requirements.

Since FCIs require shared storage, traditionally they had to be deployed within a single data center. On AWS, the shared storage can span multiple Availability Zones, enabling WSFC clusters to span multiple Availability Zones.

Implementing WSFC on AWS is similar to deploying it on premises as long as you meet these two requirements:

  • The cluster nodes are deployed inside a virtual private cloud (VPC).

  • The cluster nodes are deployed in separate subnets to provide high availability across multiple Availability Zones.

This Partner Solution meets these requirements.

For more information:

Costs and licenses

There is no cost to use this Partner Solution, but you will be billed for any AWS services or resources that this Partner Solution deploys. For more information, refer to the AWS Partner Solution General Information Guide.

This Quick Start requires a license for Microsoft SQL Server 2019. You can obtain a trial license from the Microsoft Evaluation Center.

Alternatively, if you’re not using the software for a production environment, you can use the MSSQL Developer Edition. This edition provides the full capabilities of Enterprise Edition without requiring license costs.

This Quick Start deploys MSSQL in Bring-Your-Own-License mode. It does not support deployment of MSSQL license-included Amazon Machine Images (AMIs).

Architecture

Deploying this Partner Solution with default parameters builds the following SQL Server FCI environment in the AWS Cloud.

architecture1
Figure 1. Partner Solution architecture for SQL Server FCI on AWS

As shown in Figure 1, this Partner Solution sets up the following:

  • A highly available architecture that spans two Availability Zones.*

  • A VPC configured with public and private subnets, according to AWS best practices, to provide you with your own virtual network on AWS.*

  • In the public subnets:

    • Managed network address translation (NAT) gateways to allow outbound internet access for resources in the private subnets.*

    • A Remote Desktop Gateway (RD Gateway) host in an Auto Scaling group to allow inbound Remote Desktop Protocol (RDP) access to EC2 instances in public and private subnets.*

  • In the private subnets:

    • Two EC2 instances running Microsoft Windows with SQL Server. These instances are installed as nodes in a WSFC cluster in an Always On FCI configuration across the Availability Zones. Each node contains an Amazon Elastic Block Store (Amazon EBS) root volume.

  • An Amazon FSx file system, which the FCI nodes share. SQL Server is installed in this file system. This file system also stores all SQL database and log files, and it acts as the WSFC cluster’s file-share witness.*

  • AWS Directory Service with a managed directory. The Amazon FSx file system and the EC2 Windows instances that host this architecture’s nodes are joined to the same Active Directory domain.

  • AWS Secrets Manager keys to store credentials.

  • An AWS Systems Manager automation document to automate the deployment.

*The template that deploys the Partner Solution into an existing VPC skips the components marked by asterisks and prompts you for your existing VPC configuration.

Comparison with SQL Server with Always On Replication

To better understand the architecture of the SQL Server FCI Partner Solution, it’s helpful to compare with the Partner Solution for SQL Server with Always On Replication. Both Partner Solutions are architected to ensure high availability. Both have EC2 instances clustered using WSFC. Both have database files stored in multiple Availability Zones. What’s different is the way each Partner Solution accomplishes database high availability.

The replication-based architecture requires a full installation of SQL Server (Standard or Enterprise edition) on each EC2 instance. Therefore, each EC2 instance requires a SQL Server license.

What makes the FCI-based architecture unique is that it requires only one SQL Server license. With FCI, database-related files aren’t replicated across the WSFC cluster, and SQL Server is not installed in the local file systems. Instead, this Partner Solution creates an Amazon FSx file system and installs SQL Server there. The EC2 instances (FCI nodes) share this file system, which also stores all the SQL database files and log files. In addition, this shared file system acts as the cluster’s file-share witness.

Advantages and disadvantages

The architecture of each SQL Server Partner Solution has advantages and disadvantages.

SQL Server with Always On Replication Partner Solution:

  • Advantages:

    • The EBS volume type, capacity, and IOPS can be configured, allowing flexibility.

    • It supports both AWS-provided licensing and Bring Your Own License models for Microsoft SQL.

  • Disadvantage:

    • Each WSFC node with SQL Server installed requires a SQL Server license, increasing cost.

SQL Server FCI Partner Solution:

  • Advantage: It requires only one SQL Server license.

  • Disadvantages:

    • It relies on an Amazon FSx Multi-AZ file system, which is not supported in all AWS Regions.

    • It requires the customer to provide a SQL Server .iso file and license since AWS-provided SQL licensing is not supported.

Deployment options

This Partner Solution provides the following deployment options:

This Partner Solution provides separate templates for these options. It also lets you configure Classless Inter-Domain Routing (CIDR) blocks, instance types, and SQL Server FCI settings.

Predeployment steps

The deployment of this Partner Solution requires a copy of the Microsoft SQL Server 2019 installation media as an .iso file. The typical file name is SQLServer2019-x64-ENU.iso.

  1. Download the SQL Server 2019 evaluation edition from the Microsoft Evaluation Center.

    —or—

    Obtain the .iso file from the Microsoft Developer Network if you have an MSDN account with licenses for server software.

  2. Upload the .iso file to an S3 bucket.

Deployment steps

  1. Sign in to your AWS account, and launch this Partner Solution, as described under Deployment options. The AWS CloudFormation console opens with a prepopulated template.

  2. Choose the correct AWS Region, and then choose Next.

  3. On the Create stack page, keep the default setting for the template URL, and then choose Next.

  4. On the Specify stack details page, change the stack name if needed. Review the parameters for the template. Provide values for the parameters that require input. For all other parameters, review the default settings and customize them as necessary. When you finish reviewing and customizing the parameters, choose Next.

    Unless you’re customizing the Partner Solution templates or are instructed otherwise in this guide’s Predeployment section, don’t change the default settings for the following parameters: QSS3BucketName, QSS3BucketRegion, and QSS3KeyPrefix. Changing the values of these parameters will modify code references that point to the Amazon Simple Storage Service (Amazon S3) bucket name and key prefix. For more information, refer to the AWS Partner Solutions Contributor’s Guide.
  5. On the Configure stack options page, you can specify tags (key-value pairs) for resources in your stack and set advanced options. When you finish, choose Next.

  6. On the Review page, review and confirm the template settings. Under Capabilities, select all of the check boxes to acknowledge that the template creates AWS Identity and Access Management (IAM) resources that might require the ability to automatically expand macros.

  7. Choose Create stack. The stack takes about 2.25 hours to deploy.

  8. Monitor the stack’s status, and when the status is CREATE_COMPLETE, the SQL Server Failover Cluster Instance deployment is ready.

  9. To view the created resources, choose the Outputs tab.

Postdeployment steps

Run Windows updates

In order to ensure the deployed servers' operating systems and installed applications have the latest Microsoft updates, run Windows Update on each server.

  1. Create an RDP session from the Remote Desktop Gateway server to each deployed server.

  2. Choose the Settings application.

  3. Choose Update & Security.

  4. Choose Check for updates.

  5. Install any updates and reboot if necessary.

Test the deployment

  1. Open an RDP session to one of the two SQL servers.

  2. Open Windows Administrative Tools, and launch Failover Cluster Manager.

    postdeploy1
    Figure 2. Failover Cluster Manager
  3. Choose Nodes, and ensure that both nodes are online.

    postdeploy2
    Figure 3. Both nodes showing online
  4. Select the failover cluster, and verify that both the cluster and the file-share witness are online.

    postdeploy3
    Figure 4. Cluster overview showing that both the cluster and the file-share witness are online
  5. Download SQL Server Management Studio (SSMS).

  6. Install SQL Server Management Studio. The installation requires a reboot.

  7. After rebooting, log back in to the SQL server.

  8. Launch SQL Server Management Studio, and connect to the FCI.

    50%
    Figure 5. Connecting to the cluster
  9. If you are able to log in, the deployment was successful.

Troubleshooting

For troubleshooting common Partner Solution issues, refer to the AWS Partner Solution General Information Guide and Troubleshooting CloudFormation.

If the deployment fails, follow these steps:

  1. Open the AWS Systems Manager console.

  2. Select your deployment Region.

  3. Choose Automation from the left-hand side, and locate the failed automation document.

  4. Navigate to the failed step.

  5. Expand Output to view the automation logs.

  6. Follow the link to Amazon CloudWatch Logs to view detailed automation logs.

Customer responsibility

After you deploy a Partner Solution, confirm that your resources and services are updated and configured—including any required patches—to meet your security and other needs. For more information, refer to the Shared Responsibility Model.

Feedback

To submit feature ideas and report bugs, use the Issues section of the GitHub repository for this Partner Solution. To submit code, refer to the Partner Solution Contributor’s Guide. To submit feedback on this deployment guide, use the following GitHub links:

Notices

This document is provided for informational purposes only. It represents current AWS product offerings and practices as of the date of issue of this document, which are subject to change without notice. Customers are responsible for making their own independent assessment of the information in this document and any use of AWS products or services, each of which is provided "as is" without warranty of any kind, whether expressed or implied. This document does not create any warranties, representations, contractual commitments, conditions, or assurances from AWS, its affiliates, suppliers, or licensors. The responsibilities and liabilities of AWS to its customers are controlled by AWS agreements, and this document is not part of, nor does it modify, any agreement between AWS and its customers.

The software included with this paper is licensed under the Apache License, version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at https://aws.amazon.com/apache2.0/ or in the accompanying "license" file. This code is distributed on an "as is" basis, without warranties or conditions of any kind, either expressed or implied. Refer to the License for specific language governing permissions and limitations.