This article is the second and final part of our series of articles covering AWS Auto Scaling. It provides an insight into the types of Auto Scaling, components of Auto Scaling, and the best practices for auto scaling in Amazon Web Services.
Feel free to read the first part of this series if you missed it or need to revisit it: Intro to Amazon Web Services (AWS) Auto Scaling.
Types of Autoscaling
In a nutshell, autoscaling can be of the following types:
- Reactive: When using a reactive autoscaling method, resources are scaled up and down in response to surges in traffic. This technique is strongly associated with the real-time monitoring of available resources. There is often a cooldown period involved, which is a predetermined time during which resources are maintained at maximum capacity — even when traffic decreases — to cope with any further incremental traffic surges.
- Predictive: A predictive autoscaling method uses machine learning and artificial intelligence tools to evaluate traffic loads and anticipate when you’ll need more or fewer resources. Predictive scaling analyzes each resource’s past workload and predicts the anticipated load for the following two days using machine learning. This is analogous to how weather predictions work. Predictive scaling performs scheduled scaling actions based on the prediction to ensure that resource capacity is available before your application requires it. In other words, Predictive autoscaling applies predictive analytics, including past usage data and current usage patterns, to scale depending on future demand projections automatically.
- Scheduled: Users may choose the time range based on which additional resources will be added. Scheduled autoscaling is a hybrid approach that operates in real-time, predicts known changes in traffic loads, and responds to such changes at predetermined intervals. Scheduled scaling is most effective when there are predictable traffic drops or spikes at specific times of the day, but the changes are usually very abrupt. For example, resources may be pre-provisioned in anticipation of a significant event or a peak time throughout the day, rather than waiting for resources to scale up as demand increases.
- Manual Scaling – In Manual Scaling, the number of instances is manually adjusted. You can manually increase or decrease the number of instances through a CLI or console. Manual Scaling is a good choice when your user doesn’t need automatic Scaling.
- Dynamic Scaling – This is yet another type of Auto Scaling in which the number of EC2 instances is changed automatically depending on the signals received. Dynamic Scaling is a good choice when there is a high volume of unpredictable traffic.
What is an AWS Auto Scaling Plan?
In AWS, a scaling plan is a set of instructions for scaling up or scaling down your resources. A scaling plan is one of the most important components of AWS Auto Scaling, and it should not be overlooked. Typically, you would configure a set of instructions in a scaling plan for scaling your resources here.
AWS Auto Scaling analyses each resource and makes suggestions for scaling strategies that are tailored based on the resource requirements. After a scaling plan has been created, AWS Auto Scaling combines dynamic and predictive scaling techniques and executes it.
A scaling strategy instructs AWS Auto Scaling on making the most of the resources available in your scaling plan to achieve the best possible usage. You have the option of optimizing for availability, cost, or a combination of the two. You may design your custom strategy based on the metrics and thresholds that you provide as an alternative. You may also create different strategies for each resource or resource type that you want to use.
You can take advantage of scaling strategy to optimize resources in your application and create your own scaling strategy based on the required metrics and thresholds. You may create a separate scaling strategy for each group of resources by using AWS CloudFormation or adding tags to your AWS resources.
Scaling Plans Offered by AWS
Here are the scaling plans offered by Amazon’s AWS:
- Maintaining the current instance level at all times: Using this scaling plan, the user may create an AWS auto-scaling group always to have a specific number of active instances.
- Manual scaling: This scaling plan enables the user to define the required capacity of AWS auto-scaling groups. The auto-scaling service takes care of generating and terminating instances automatically.
- Scaling on a schedule: This scaling strategy is beneficial when the user can forecast when the application’s traffic will grow. In such situations, the user may choose a time for AWS auto-scaling to run.
- Scaling according to demand: This scaling plan enables the user to specify scaling criteria such as CPU and Memory utilization, and so on.
Components of Auto Scaling in AWS
There are several components involved in Auto Scaling in AWS, such as the following:
- AMI: An AMI, an acronym for Amazon Machine Image, is an executable image of your EC2 Instance that you may use to create new instances on Amazon’s cloud computing platform.
- Load Balancer: A load balancer can automatically detect the traffic flowing through it and route traffic based on pre-defined rules. Load balancing is a process that can distribute the traffic among instances, optimize resource use, maximize throughput, minimize response time, improve the application’s throughput, and ensure that a particular resource is not overloaded.
- Snapshot: The copy of the data that you have on your hard drive is an image of the storage device that you have on your computer. You can take advantage of an AMI, an executable image, to build a new virtual machine in Amazon Cloud. On the contrary, a snapshot is just a clone of the data that is already there in your Instance on Amazon Web Services.
- EC2 Instance: Essentially, an EC2 instance, also known as an Elastic Compute Cloud instance, is a virtual server that can serve an unlimited set of virtual machines and is used for running applications on the Amazon Web Services (AWS) infrastructure.
- Autoscaling Groups: An Auto Scaling Group is a collection of Amazon EC2 instances that have been logically grouped for automatic scaling.
Best practices for AWS Auto Scaling Scaling Plans
Here are a few guidelines and best practices that can help you make the most of the AWS Auto Scaling scaling plans:
If possible, you should scale Amazon EC2 instance metrics on a one-minute interval since this allows for a faster response to changes in usage patterns. A longer response time and scaling on outdated metric data are possible consequences of scaling on updated measurements every five minutes (or less). When Amazon EC2 instances are first created, they are configured for basic monitoring, which means that metric data for the instances are accessible at 5-minute intervals by default. In addition, you may activate comprehensive monitoring for an extra fee to get metrics data for instances in a one-minute interval of time.
It’s also a good idea to activate Auto Scaling group metrics. If you don’t do this, the actual capacity data will not be shown in the capacity forecast graphs that are made accessible once the Create Scaling Plan wizard has been completed. It would help if you chose the Enable Group Metrics Collection in the Amazon EC2 interface after creating an Auto Scaling group in the Amazon EC2 console. To achieve this, go to the Monitoring tab and select the Enable Group Metrics Collection. These measurements describe the group as a whole rather than any individual occurrences inside it.
Check to see which of your Auto Scaling group is using the instance type. In some instances, depending on the target usage stated by the scaling plan, you may run the risk of surpassing the baseline and subsequently running out of CPU credits, which would result in performance being negatively impacted.
Summary of AWS Auto Scaling
There are no additional charges for using AWS Auto Scaling. There is no need to pay for anything other than the AWS resources required to operate your apps and the costs associated with Amazon CloudWatch monitoring.