SQL – Creating a SQL Server AlwaysOn on Amazon EC2, Part 1

I was keen to test SQL Server AlwaysOn feature for some time now. And in this post I’ll share some of the configuration steps that I have encountered by bringing AlwaysOn cluster on Amazon EC2.

There is a really helpful Amazon whitepaper related to this topic [AlwaysOn], but I’ve decided to make my life complicated and chose to use Free Tier micro instances [t1.micro]. As a result I had to change the networking design quite significantly.
Micro instances have a restriction on the network interfaces: each instance can have 2 network adapters at most and each adapter can have a maximum of 2 IPs enabled. This is a purely EC2 limitation, in Windows I can configure as many IPs as I want, but they won’t be able to interact with the network. EC2 will be filtering out invalid IP addresses.

OK, so lets start with the high level design. I want to have two SQL servers located in the separate sites [separate Amazon Availablity Zones], belonging to the same SQL AlwaysOn Group. Because AlwaysOn is based on Windows Failover Cluster I need that as well, just without a shared storage. And I also need a Domain Controller, puting it in yet another site.

Now lets define our detailed design. I’m going to have a single VPC with 5 subnets:
ANetworking1On the Amazon side, IP addresses will be configured in the following maner:
ANetworking2Here we are having:
WIN2012DC – Windows Server 2012 Standard
WIN2012R2-1 – Windows Server 2012 R2 Standard
WIN2012R2-2 – Windows Server 2012 R2 Standard
SQL Server – SQL Server Enterprise 2014

I assume that creating an AD and joining servers to a domain is something straightforward therefore I’m not going to mention it here.

When the above is done we gonna add one more network adapter to each SQL server. Go to “Network Interfaces” and create two more. Make sure that zones are selected according to the design diagram, us-west-2b and us-west-2c accordingly:
AInterfacesNow, attach newly created interfaces to the SQL servers. You will see thatΒ  an instance is able to see/attach those interfaces that are available/free only in the same zone. For example, server in us-west-2b can only see an unused interface in us-west-2b.


When interfaces are attached we need to configure “allowed” IP addresses. Remember that Amazon allowed IPs and Windows IP configuration are two related but different things.
To allow IP addreses for use you select the instance, then click on “Actions” and then select “Manage Private IP Addresses”:
AInterfaces2SQL server Node 1 will be allowed to use these IPs:
AInterfaces3SQL server Node 2 will be allowed to use these IPs:
AInterfaces4Now we are ready to configure Windows. I’m going to configure static IP addresses. Only one address per interface for now, this is because secondary IPs will be assigned during the Cluster and SQL AlwaysOn configuration.

For Node 1 I’m going to have:

Node1BeforeClusterFor Node 2:

Node2BeforeClusterMake sure that ping is travelling in all directions. If so, then we are ready to configure a Windows Failover Cluster in Part 2 πŸ™‚

Leave a Comment here

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s