Cloud Computing: Set Up Auto Scaling Using Amazon Web Services (AWS)

Introduction to Cloud Computing

Cloud computing has become a go-to service for most companies these days when it comes to web application deployments. Cloud computing infrastructure provides a host of improvements over traditional web hosting architecture, and thus has become more popular by the day. Some of the benefits are:

  • Ease of use when deploying a new web application or updating an existing one.
  • Flexibility in selecting the combination of hardware and software that best suits you need.
  • Cost-effective, as you only pay for the resources you use and for the time duration you use them. No long-term contract is necessary.
  • Reliability comes from the fact that your web application can be hosted on multiple locations/regions to provide high availability and automated backup of data built in. 
  • High performance and scalability is build into the design of Cloud computing infrastructure where it becomes easy for web applications to adapt to the traffic demands both ways (scaling up and down).
  • Security of the data is paramount for any company, and cloud computing infrastructure provides multi-layers security at both hardware and software level for peace of mind.
Auto Scaling

Auto scaling is one for the critical feature of cloud computing and we are going to look into it in more detail in this article. Auto scaling is an important part of handling the fluctuation in traffic that an app gets. In a traditional server setup one has to figure the max traffic an app is expected to receive and according to that estimate purchase/setup the hardware well in advance. When in low traffic mode, this additional hardware is lying unused, incurring maintenance cost. In a modern cloud infrastructure, a company designs their app architecture to auto scale, and sets up the hardware to auto scale as per the traffic. Because the hardware can scale up and down automatically, there is no need to buy hardware in advance and because of the pay-as-you-go billing method,  a company only pays for the services used for the duration of usage.

Amazon Web Services (AWS) is one of the most popular service providers in the cloud computing market currently, with largest market share. I am going to take the example of AWS on how to setup auto scaling for your app.

AWS provides the option to scale up and scale out. Scale up is to add more powerful EC2 instance as traffic increases, and scale out is adding more EC2 instance to help your app handle the addition load.

Ideally you should architect your app to scale out. This means that instances are added or removed as per the traffic your app is receiving. The best thing about auto scaling is that it can be automated. AWS provides a set of services to achieve this.

As of June 2016, AWS has more than 50 services under its platform. For auto scaling we need to worry about only a few of them listed below.

  1. EC2
  2. VPC
  3. RDS
  4. Route53
  5. CloudWatch
  6. CloudFront
Steps for setting up auto scaling using AWS.

Step 1: Create a Security Group that will be used while creating your EC2 instance. Security Groups are like firewalls having rules for inbound and outbound traffic.

Step 2: Create IAM role that will be used while creating your EC2 instance.

Step 3: Launch EC2 instance for deploying your web application.

Step 4: Login into the server (RDP/SSH) and configure it as per your requirement.

Step 5: After successful setup, create an AMI of your server. AMI is a custom image of your server that can be used to launch a new server with same configuration.

Step 6: Create and setup a Database server as per your requirement using Amazon RDS. Please note that you will need to create another Security Group to use with your database server.

Step 7: Create a Load Balancer. Assign the same Security Group you created in step 1. You Will also select the EC2 instance you created in step 3 to attach it to the Load Balancer.

Step 8: Create a Launch Configuration. This is the info Load Balancers use to add additional instances per the traffic. Here you specify the AMI you created in step 5, IAM role you created in step 2 and also instance type (eg. t2.micro, t2.small etc).

Step 9: Configure Auto Scaling Group. Here you specify the minimum and maximum server instances that you want to scale to. You will select the name of Load Balancer that you created in step 7. Here you will also specify the policies that will be used to scale up or down. You can specify policies using metric such as CPU, Memory or Network usage. You can also specify how many instances you want to add at once when you scale up and how many to remove when you scale down.

Step 10: Associate the domain name of your app with the Load Balancer using Amazon Route53. Locate the DNS name from the Load Balancer page. In the Route53, create a Hosted Zone and then create a Record Set of Type A, set Alias to yes and then from Alias Target drop-down, select the name of the Load Balancer created in step 7. Please note that you will need to set up the NS records provided by Route53 with your domain name and wait for the successful propagation of records before you move to the next step.

Step 11: Test the app by opening it up in a web browser with the domain name you have associated with in step 10.

I understand that I have provided a very high level info on auto scaling and how to set it up in AWS.

For more in depth information please contact us or visit the link below.

http://docs.aws.amazon.com/autoscaling/latest/userguide/WhatIsAutoScaling.html

Write a comment