Autoscaling to One: A High Availability Technique

There are certain types of servers that you’d desire to have highly available, but the cost of running multiple servers would be a bit impractical.

In our scenario, we’ll setup a management instance behind a load balancer. The instance will be part of an auto scaling group, which will lauch a new instance in the event of a failure.

Here’s a diagram of what we’re building:

ASG.png

First, we’ll need to prep a server (install and configure desired tools in OS, etc) that will be used as the template for the management instance. Once prepped, we’ll create the AMI.

AMI.png

It is generally preferred to leave the No reboot box unchecked, as selecting it could technically lead to inconsistencies in the image.

AMI2.png

After a bit, we’ll find our newly created AMI.

ami4.png

Next we’ll create a Load Balancer.  For our purposes, The Network Load Balancer is the best option.

lb1.png

We’ll name the load balancer and listen on 3389. With the proper VPC selected, we’ll specify our availability zones.

lb2.png

LB3.png

Now, we’ll create a new target group, also on port 3389

LB4.png

We won’t register any targets yet- we’ll use the ASG for that. Just click next.

lb5.png

Ok, now we’ll create a launch configuration as a prerequisite for our auto scaling group.  After clicking Create launch configuration,  select our AMI, pick the instance size, name the AMI, etc…

ami11.png

ami2_001.png

ami3.png

After the launch configuration is complete, we’ll begin our auto scaling group. We’ll specify the subnets that we want to utilize. We also need to specify our target group.

asg111.png

Since we just want to keep 1 instance up at any given time, we’ll leave ‘keep this group at its initial size’ selected.  The remaining steps involve notifications and tags, which can be used if desired.

asg2.png

To sum up, our autoscaling group will spin up 1 instance, and maintain 1 instance as long as the health checks come back OK.  Proceeding at this step automatically spins up an instance.

After our new instance has initialized, making an RDP connection to our load balancer DNS name will connect us to the instance.

lb7.png

lb8.png

Now, the whole point of this was to have the instance recover in the event of failure. So, let’s make it fail by setting a static IP on the nic in Windows that is invalid…this will cause an instance check failure.

asg12.png

Saving those settings and things go down.

asg13.png

After a bit, we’ll see the instance checks fail.

ic1.png

The instance is eventually deemed unhealthy by the target group, then the autoscaling group. Then, it will be terminated and a new instance will be launched.

ic3.png

After the new instance has passed all of its health checks, we are able to connect via RDP to our load balancer DNS name.

lb7.png

lc3.png

…and that’s all there is to it.

 

 

 

 

Leave a Reply

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 )

w

Connecting to %s