Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides resizable compute capacity in the cloud. Amazon Cloud Computing is a good choice if you want to deploy very large scale network on the cloud which requires high availability, auto scaling and load balancing features.
In this article I will explain how you can configure High Availability for Microsoft Sql Server 2005/2008 & Web server (IIS) in Amazon EC2. I am assuming that you have basic idea and knowledge of how Amazon EC2 works.
First of all let’s start with Amazon Load Balancing for Web Server.
Assuming that you have created 2 instances for your web server in Different Availability Zones and deployed your web application on IIS.
Just go to Load Balancer tab in EC2 menu,and then click on Create a New Load Balancer
Select Ping Protocol http, Ping Port 80, ping file name: iisstart.htm
Note: Ping Path file should be there to work load balancer, load balancer will check iisstart.htm file at 0.5 minutes interval.
On next page just select your 2 web server’s instances
Just click on create button in next screen.
Make sure that you’re both web servers instances are on different Availability Zone. For example 1 web Server on US-East-1a and other web server’s instances on US-East-1d as shown in above screenshot.
Different Availability Zones means different data centers of Amazon in same Region.
You can check your Load Balancer’s status on below link . Make sure that your both instances are In Service mode.
That’s it your web server is now configured with load balancer URL which Amazon provides.
Now you can access your web Server from Load Balancer’s URL.
For Sql Server’s High Availability we can’t use load balancer but we have different options like Database Replication, Database Mirroring.
Now let’s see how to configure database mirroring in Sql Server 2005/2008.
For Database mirroring just take full database backup of primary database and restore it on secondary server with no recovery option. You also have to install Sql Server in witness server to have automatic fail over of the database.
Sql Server’s Database mirroring uses port 5222 port number so make sure that you have open 5222 port number in your security group (firewall).
After restoring database on secondary server go to primary server, just right click on your database then click on database mirror wizard and follow the instruction as below
Click yes on do you want to configure security to include witness server roles wizard.

Select primary database instances on below screen.
Select your mirror server instances
Select the Witness Server’s Sql Instances
Click finish button to start the database mirroring .
That’s it. Your Sql server’s high availability setup is completed. If your primary server goes down it will automatically switch connection to mirror server and your mirror server becomes active now. So your clients or you will not have any problems at all to access your application!

















