Features and benefits of Auto-Scaling in Amazon EC2
Every application has its own set of needs: CPU, storage, memory and networking powers. These have to be integrated in a certain configuration to allow smooth functioning of the app. With Amazon Elastic Computing Cloud (EC2) instance types, you can add in different instance types which permit to sync your resources to the needs of the app. Auto-Scaling defines the scaling policies to instantly adapt to the application’s needs, scales the resources in sync with the CloudWatch alarms and examines the history of scaling events. The three regions where Auto-Scaling is currently available are us-east-1, us-west-2 and eu-west-1.
How many EC2 instances do you need to support the workload of your application? Auto-Scaling option of Amazon assists you to choose the correct amount of EC2 to tune in with the workload of your application. Collection of EC2 instances can be formulated, named Auto-Scaling Groups. Every Auto-Scaling Group can be allotted maximum number of instances. Your group will never exceed this size. You can also mention the desired instance-capacity when you are creating the group. In case you mention scaling rules/policies, Auto-Scaling starts and terminates instances depending on the demand of your application.
As the demand on your application increases, Auto-Scaling accordingly amplifies the number of EC2 enhancing the performance. The Auto-Scaling option fits well for both types of applications: those which have a consistent demand pattern and those which have variable use.
Consider an Auto-Scaling group with minimum size of 2 instances, a desired capacity of 3 instances and maximum size of 6 instances. The scaling policies which are stated will align the number of instances to the number of instances mentioned.
Core Components of Auto-Scaling
The main features of auto-scaling are:
The EC2 instances will be categorized into groups. Doing this will allow them to be “treated as a logical unit for the purposes of scaling and management”.
- Scaling plans
Auto-Scaling can be instructed on when and how to scale through the scaling plans. For instance, you can structure a scaling plan around certain conditions (dynamic scaling) or according to a schedule.
- Launch configurations
The launch configuration is used as template for the EC2 instances by scaling group. A launch configuration contains information about instance type, AMI ID, security groups, key pair and block device mapping for the instances.
- Fault-alignment: When an instance is not healthy, then Auto-Scaling can detect it immediately. The instance could be terminated or another instance could be launched to substitute on it. Many availability zones can be used after configuring Auto-Scaling.
- Cost management: Auto-Scaling supplies the amount of capacity required by the application. Since you are only paying for the EC2 instances that you are using, you will cut down expenses by not launching unrequired instances.
- Credit Card data storage: With Auto-Scaling, you can store, process and transmit credit card data by service provider or merchant. This feature has been declared compliant with the Payment Card Industry (PCI) Data Security Standard (DSS).
- Availability: Auto-Scaling keeps track of the demands of your application and makes sure that the application has correct amount of capacity to answer to the traffic needs.
3 Stages of Auto-Scaling
Stage 1: Creating a Launch Configuration
The launch configuration mentions the EC2 instances generated by Auto-Scaling.
When you open the navigation pane in Amazon EC2 console (under Auto-Scaling), you will find Launch Configurations. On selecting “Create Auto-Scaling Group” on the Welcome to Auto-Scaling page, you can access the “Create Launch Configuration” option. Select the “Choose AMI” option where AMI refers to the Amazon Machine Images. This will put forward a list of basic configurations which will be templates for instances. Select 64-bit Amazon Linux AMI. In the Choose Instance Type sheet, pick out the hardware configuration for the instance. Make sure you use the t2.micro instance which is selected by default. Move on to configure details where you enter the name of your launch configuration in Name, choose the IP address type under Advanced Details and then configure.
Select the “Edit security groups” option on Review page. Lastly, create the Launch Configuration on Review page. You can either choose an option from those mentioned from “Select an existing key pair” or you can create a new key pair. Create the launch configuration using the “Create launch configuration” option.
Stage 2: Create an AWS Auto-Scaling Group
Auto-Scaling groups refers to set of EC2 instances. They are the prime feature of AWS Auto-Scaling service. You can create the Auto-Scaling group by mentioning the launch configuration. You can also put in the Availability Zone.
For creating an Auto-Scaling group, start with configuring the Auto-Scaling Group on its details page. Here, you will mention the name of Auto-Scaling group (Group Name) and then, choose a VPC in the Network (to launch t2.micro instance). In case you choose VPC in the last step, then select the “Selected subnet” and in case you choose E2-Classic, then find an Availability Zone.
Proceed to configure scaling policies. Review the group and select the option of Create Auto-Scaling Group.
Stage 3: Verify AWS Auto-Scaling Group
In case you wish to check if the Auto-Scaling group has launched the EC2 instance, then follow the given method. Choose the Auto-Scaling group which you have previously created. The Details tab can be used to explore the information about application. Use the “Scaling History” option to check the current status of instance (on Progress). When the instance is launching, the Status column will show “In Progress”. Once the instance is launched successfully, it shows “Successful”. By selecting the Instances button, you can check out the health condition and lifecycle of the instance. The Lifecycle column shows the status of previously launched instance. You can either delete the AWS Auto-Scaling set-up or the AWS Auto-Scaling group. When you choose the latter option, the launch configuration is maintained for later use.
Launched in 2009, Auto-Scaling has emerged as an athletic feature for websites and applications to run a scalable infrastructure. With a scalable infrastructure, you can cater to the needs of your app and website automatically, no matter how it scales over the time. Auto-Scaling is commonly carried out through front-end site traffic scaling (here, the scaling is done depending on the number of incoming requests) and back-end batch processing (here, the scaling is based on load and time).
Is your organization ready to embrace the benefits of AWS Auto-Scaling? Leave your comment here.
To know more about Suyati’s expertise in cloud technologies and AWS, please send an email to email@example.com.