Would you like to discuss your environment with a knowledgable engineer?
This article will guide you through setting up a fault tolerant cluster on AWS. We’ll be using Elastic Load Balancer and Route 53’s health checking options.
Amazon infrastructure spans autonomous regions which in turn is divided into Availability Zones (AZ).
AWS Elastic Load Balancer (ELB) with distribute traffic between healthy AZs.
Route 53 DNS Fail-over will distribute traffic between regions.
This allows us to survive both failure in individual AZs and whole regions going off-line.
First select the first region you want to support. You will repeat these steps for every region.
Create aiScaler EC2 instances
For each AZ and region you want to support, you need to create one aiScaler instance.
Select the aiScaler image from the AWS Marketplace and select “Launch with EC2 Console”. During Step 3 select a AZ. Repeat this step for each AZ you want to support. See this guide for a detailed description.
Configure your aiScaler instances to use your backend servers. Refer to the general getting started guide for this.
aiScaler instances in a cluster can communicate with each other. The most common reasons are to communicate: cache invalidation, offending IP addresses (to form one coherent shield against DDoS attacks) and origin server time-outs.
To take advantage of aiScaler’s cluster features add a peer statement for each of your aiScaler instances to the configuration file. You also need to specify a secret passphrase for the cluster to use with peer_prefix.
peer <instance 1 hostname> peer <instance 2 hostname> peer_prefix <shared cluster secret>
In the EC2 Dashboard, select “Load Balancer” under “Network & Security”, then select “Create Load Balancer”.
Screen 1: Give your load balancer a name
Screen 2: Here you’ll configure health checking of your aiScaler servers, leaving this at the default will make ELB check your site for an OK response every 30 seconds.
You might want to change this if you have special checks, for example to a special uncached page, that checks backend health, as well as aiScaler health.
Screen 3: Here you’ll add the aiScaler instances created in the previous step.
Take note of your ELB DNS Name.
You now have a region-wide highly available service, repeat this one or more time, for each other region you want to support.
Set up Route 53 health checking
Select “Create Hosted Zone” and enter your domain name, then select “Go to Record Sets”. Select “Create New Record Set”.
Select that your record is an “Alias” and enter the DNS name of your first ELB. For “Routing Policy” select “Weighted”, give your ELB a weight of 1 and set the Set ID to the name of region your ELB is in, for example “nvirginia”. Every ELB should have a weight of 1, which will distribute the load evenly.
Point your registrar’s GLUE records to your Route 53 name servers and you’re done.