Question: How do I create an SQL Server Always On availability group cluster in the AWS Cloud?

I want to create an SQL Server Always On availability group cluster in the AWS Cloud. How can I do this?Short descriptionTo create an SQL Server Always On availability group cluster in the AWS Cloud, first configure two secondary IPs for each cluster node elastic network interface. Then, use Remote Desktop Protocol (RDP) to connect as a Domain Administrator account to the cluster node instances. Finally, create a two-node Windows cluster and SQL Server Always On availability groups.You can also use AWS Launch Wizard to create an SQL Server Always On availability group deployment. The Launch Wizard identifies the AWES resources to provision the SQL Server databases automatically based on your use case. For more information, see What is AWS Launch Wizard for SQL Server?ResolutionPrerequisitesLaunch two Amazon Elastic Compute Cloud (Amazon EC2) Windows Server instances (version 2012 R2 or later) across Availability Zones inside a Virtual Private Cloud (VPC).Use SQL Server 2014 64-bit Enterprise edition or later. For testing, use SQL Server 2014 64-bit Evaluation edition or later.Configure secondary Amazon Elastic Block Store (Amazon EBS) volumes to host SQL Server Master Data File, Log Data File, and SQL Backup files. It's a best practice to choose Provisioned IOPS SSD (io1) EBS volumes for large SQL Server database workloads.Deploy the cluster nodes in private subnets. You can then use RDP to connect from a jump server to the cluster node instances.Configure security group inbound rules and Windows Firewall exceptions to allow the nodes to communicate in a restrictive environment. See Configure the Windows Firewall to allow SQL Server access on the Microsoft website.Active Directory (AD) domain controllers must have all necessary ports opened for the SQL nodes and witness to join the domain and authenticate against Active Directory. See Active Directory and Active Directory Domain Services Port Requirements on the Microsoft website.Join the nodes to the domain before creating the Windows failover cluster. Verify that you are logged in using domain credentials before creating and configuring the cluster.Run the SQL DB instances with an Active Directory service account.Create an SQL login with sysadmin permission using Windows domain authentication. Consult your Database Administrator for more information. For more details, see Create a login using SSMS on the Microsoft website.Verify that the SQL browser is configured properly. This is required only for SQL Server named instances.Configure the secondary IPs for each cluster node elastic network interfaceA secondary IP is required for each cluster node eth0 elastic network interface. If you want an SQL Group Listener, then you need to add a third IP address. This results in total of 3 IPs that are attached to the eth0 elastic network interface.Note: If you don't plan to deploy an SQL Group Listener, add only one secondary IP for each cluster node elastic network interface.1.    Open the Amazon EC2 console, and then choose the AWS Region that will host your Always On cluster.2.    Choose Instances from the navigation pane, and then select your EC2 cluster instance.3.    Choose the Networking tab.4.    Under Network interfaces, choose the Interface ID elastic network interface.5.    Select the network interface, and then choose Actions, Manage IP addresses.6.    Choose the arrow next to the network interface ID to expand the window, and then choose Assign new IP address. You can select a specific IP or leave the field as Auto-assign. Repeat this step to add a second new IP.7.    Choose Save, Confirm.8.    Repeat steps 1-7 for the other EC2 instance that will participate in the cluster.Create a two-node Windows cluster1.    Connect to your EC2 instance using RDP with a domain account that has local Administrator permissions on both nodes.2.    On the Windows Start menu, open Control Panel, and then choose Network and Sharing Center.3.    Choose Change adapter settings from the navigation pane.4.    Select your network connection, and then choose Change settings of this connection.5.    Select Internet Protocol Version 4 (TCP/IPv4), and then choose Properties.6.    Choose Advanced.7.    On the DNS tab, choose Append primary and connection specific DNS suffixes.8.    Choose Ok, choose Ok, and then choose Close.9.    Repeat steps 1-8 for the other EC2 instance that will participate in the cluster.10.    On each instance, install the cluster feature on the nodes from the Server Manager, or run the following PowerShell command:Install-WindowsFeature –Name Failover-Clustering –IncludeManagementTools11.    Open cmd as Administrator, and enter cluadmin.msc to open the Cluster Manager.12.    Open the context (right-click) menu for Failover Cluster Manager, and then choose Create Cluster.13.    Choose Next, and then choose Browse.14.    For Enter the object names to select, enter the cluster node hostnames, and then choose Ok.15.    Choose Next. You can now choose whether you want to validate the cluster. It's a best practice to run a cluster validation. If the cluster doesn't pass validation, Microsoft might not be able to provide technical support for your SQL cluster. Choose Yes or No, and then choose Next.16.    For Cluster Name, enter a name, and then choose Next.17.    Clear Add all eligible storage to the cluster, and then choose Next.18.    When the cluster creation is complete, choose Finish.Note: Cluster logs and reports are located at the following path: %systemroot%\cluster\reports19.    In the Cluster Core Resources section of Cluster Manager, expand the entry for your new cluster.20.    Open the context (right-click) menu for the first IP Address entry, and then choose Properties. For IP Address, choose Static IP Address, and then enter one of the secondary IPs associated with eth0 elastic network interface. Choose Ok. Repeat this step for the second IP Address entry.21.    Open the context (right-click) menu for the cluster name, and then choose Bring Online.Note: It's a best practice to also configure a File Share Witness (FSW) to act as a tie breaker. You can also use Amazon FSx for Windows File Server with Microsoft SQL Server. For information on FSW, see Failover Cluster Step-by-Step Guide: Configuring the Quorum in a Failover Cluster on the Microsoft website.Create Always On availability groups1.    Open SQL Server Configuration Manager.2.    Open the context (right-click) menu for the SQL instance, and then choose Properties.3.    On the AlwaysOn High Availability tab, select Enable AlwaysOn Availability Groups, and then choose Apply.4.    Open the context (right-click) menu for the SQL instance, and then choose Restart.5.    Repeat steps 1-4 on the other cluster node part of the cluster.6.    Open Microsoft SQL Server Management Studio (SSMS).7.    Log in to one of the SQL instances with your Windows authenticated login that has access to the SQL instance.Note: It's a best practice to use the same MDF and LDF directory file paths across the SQL instances.8.    Create a test database. Open the context (right-click) menu for Databases, and then choose New Database.Note: Be sure to use the Full recovery model on the Options page. For more information, see Recovery Models (SQL Server) on the Microsoft website.9.    For Database name, enter a name, and then choose Ok.10.    Open the context (right-click) menu for the new database name, choose Tasks, and then choose Back Up. For Backup type, choose Full.11.    Choose Ok, and then choose Ok.12.    Open the context (right-click) menu for Always On High Availability, and then choose New Availability Group Wizard.13.    Choose Next.14.    For Availability group name, enter a name, and then choose Next.15.    Select your database, and then choose Next.16.    A primary replica is already present in the Availability Replicas window. Choose Add Replica to create a secondary replica.17.    For Server name, enter a name for the secondary replica, and then choose Connect.18.    For Availability Mode, decide which availability mode you want, and then choose Synchronous commit or Asynchronous commit for each replica. For more information, see Differences between availability modes for an Always On availability group on the Microsoft website.19.    Choose Next.20.    Choose your data synchronization preference, and then choose Next. For more information, see Select Initial Data Synchronization Page (Always On Availability Group Wizards) on the Microsoft website.21.    When the validation is successful, choose Next.Note: You can safely ignore Checking the listener configuration, as you'll add it later.22.    Choose Finish, and then choose Close.Add an SQL Group Listener1.    Open SSMS, and then expand Always On High Availability, Availability Groups, [primary replica name].2.    Open the context (right-click) menu for Availability Group Listeners, and then choose Add Listener.For Listener DNS Name, enter a name.For Port, enter 1433.For Network Mode, choose Static IP.3.    Choose Add.For IPv4 Address, enter the third IP address from one of the cluster node instances, and then choose Ok. Repeat this step, using the third IP address from the other cluster node instance.4.    Choose Ok.Note: Errors received when adding an SQL Group Listener indicate missing permissions. For troubleshooting steps, see the following resources on the Microsoft website:KB2829783 - Troubleshooting AlwaysOn availability group listener creation in SQL Server 2012Create Availability Group Listener Fails with Message 19471, 'The WSFC cluster could not bring the Network Name resource online'Test failover1.    Using SSMS, open the context (right-click) menu for the primary replica on the navigation menu, and then choose Failover.2.    Choose Next, and then choose Next.3.    Choose Connect, and then choose Connect.4.    Choose Next, and then choose Finish. The primary replica will become the secondary replica after failover.

Related informationBest practices and recommendations for SQL Server clustering on EC2SQL Server with Always-on Replication on AWSAWS Launch WizardConfigure a listener for an Always On availability group (on the Microsoft website)