How do I launch Microsoft SQL Server on an EC2 Windows instance?
Last updated: 2022-12-07
I want to launch Microsoft SQL Server on my Amazon Elastic Compute Cloud (Amazon EC2) Windows instance. How can I do this?
New SQL environment deployments are classified under three categories:
- SQL Server standalone
- SQL Server failover cluster instances (FCI)
- SQL Server Always On availability groups (AG)
Before launching SQL Server on your instance, review the following points:
- The built-in availability form of clustering in Windows Server is activated by a feature named Failover Clustering. This feature allows you to build a Windows Server Failover Cluster (WSFC) to use with an AG or FCI.
- Always On is an umbrella term for the availability features in SQL Server and the term covers both availability groups and FCIs. Always On isn't the name of the AG feature.
- The major difference between FCI and AG is that all FCIs require some sort of shared storage, even if it's provided through networking. The FCI's resources can be run and owned by one node at any given time. An AG doesn't require that shared storage is also highly available. It's recommended to have replicas that are local in one data center for high availability and remote in other data centers for disaster recovery. Each replica with separate storage.
- An AG also has another component called the listener. The listener allows applications and end users to connect without needing to know which SQL Server instance is hosting the primary replica. Each AG has its own listener.
- For a list of supported versions and minimum requirements, see Using SQL Server in Windows on the Microsoft website.
You can use AWS Launch Wizard to launch Microsoft SQL Server on Amazon EC2. AWS Launch Wizard supports all SQL Server deployment options. For more information, see What is AWS Launch Wizard for SQL Server?
Deploy SQL Server standalone
To use the AWS Launch Wizard, access the Launch Wizard console. For Deployment Model, choose SQL Server Single instance deployment to deploy your SQL Server database on a single node. For more information, see Deploy an application with AWS Launch Wizard for SQL Server on Windows.
For SQL Server standalone deployment, you can use one of the Amazon Machine images (AMI) provided by AWS with an included SQL license. You must use the version of SQL that comes with the AMI. However, you can customize it for your needs using the setup included in the AMI. For more information, see SQL Server AMIs provided by AWS.
Deploy SQL Server FCI
FCIs provide availability for the entire installation of SQL Server, known as an instance. This means that everything inside the instance, including databases, SQL Server Agent jobs, and linked servers move to another server if the underlying server fails.
To provide a shared storage for FCI use one of the following solutions:
- Use Amazon FSx for NetApp ONTAP. Deploy Amazon FSx for ONTAP, configure iSCSI Storage connections, and setup Window Failover Clustering (WSFC). For more information, see SQL Server high availability deployments using Amazon FSx for NetApp ONTAP.
- Use Amazon FSx share. Deploy Amazon FSx file systems in the same Availability Zones (AZ) as the SQL Server FCI cluster nodes. Additionally, deploy the file share witness into a third AZ to keep the majority vote if there is a loss of one AZ. For more information, see Simplify your Microsoft SQL Server high availability deployments using Amazon FSx for Windows File Server.
To deploy SQL Server FCI, do the following:
Before you begin, deploy Amazon FSx for NetApp ONTAP or Amazon FSx share using the instructions provided in the preceding section.
After deploying a two-node cluster, deploy SQL Server onto it using the following steps:
- Connect to the first virtual machine by using the remote desktop protocol (RDP).
- In Failover Cluster Manager, make sure that all core cluster resources are on the first virtual machine. If necessary, move all resources to that virtual machine.
- Locate the installation media. If the virtual machine uses an AMI, then the media is located at C:\SQLServerSetup\Setup media.
- Select Setup. In the SQL Server Installation Center, select Installation.
- Select New SQL Server failover cluster installation. Follow the instructions in the wizard to install the SQL Server FCI.
Note: The FCI data directories need to be on clustered storage. For Amazon FSx NetApp ONTAP, you can connect to the file system over iSCSI.
- After you complete the instructions in the wizard, setup installs a SQL Server FCI on the first node. Connect to the second node using RDP.
- Open the SQL Server Installation Center, and then select Installation.
- Select Add node to a SQL Server failover cluster. Follow the instructions in the wizard to install SQL Server and add the server to the FCI.
To use the AWS Launch Wizard instead of manual deployment, access the Launch Wizard console. For Deployment Model, choose High Availability deployment - Always On Failover Cluster Instances. For more information, see Simplify SQL Server Always On deployments with AWS Launch Wizard and Amazon FSx.
Deploy SQL Server Always On availability group (AG)
To use the AWS Launch Wizard, access Launch Wizard console. For Deployment Model, choose High Availability deployment - Always On availability. For more information, see Deploy an application with AWS Launch Wizard for SQL Server on Windows.
To deploy manually, see How do I create a SQL Server Always On availability group cluster in the AWS Cloud?
Connect to SQL Server
After deploying SQL Server on your instance, you can connect to it using one of the following tools:
- Use SQL Server Management Studio (SSMS). For more information, see How do I allow a domain user to access the SQL Server instance on an EC2 instance?
- Use SQL Server Configuration Manager. For more information, see SQL Server Configuration Manager on the Microsoft website.