AWS Auto scaling and AMIs
In this blog, we will understand “what is auto scaling in AWS?” but before that let’s understand why do we need autoscaling in the first place. A limited number of servers to cope with the application load can result in various failures and latency issues when the number of requests rises. Increase in the number of requests is inevitable within a growing business and with the increase in the number of requests, the load on servers also increases.
Amazon Web Services offer an AWS auto scaling service to deal with these issues. Autoscaling makes it possible to make resources highly available which in turn eliminates various failure issues related to the increased load on limited servers.
Watch this AWS end to end tutorial video:
In this blog on what is auto scaling in AWS, the below-listed topics will be covered to learn more about AWS autoscaling and AMIs
- What Are AMIs and Snapshots?
- Difference Between AMIs and Snapshots
- What Is Auto Scaling in AWS?
- Scaling Plans
- Configuring AWS Auto Scaling Properties and Attaching AMIs
So without further delays, let’s get started.
What Are AMIs and Snapshots?
While launching an EC2 instance, you have to install and configure your instance as required. The process seems simple and trivial and it sure is, until you require multiple instances with exactly the same configurations. Traditionally, in this scenario, you will simply launch an instance, configure it, and install the required software, and then you will launch another instance and do the same for it. And then, you will keep on repeating this process for as many times as the number of instances you need. So every time you launch an EC2 instance, you will have to install all the required software on it. But, what if you could launch multiple instances with the same configurations at one go? How can one do that? Well, for this purpose, you have AMIs.
Learn AWS from experts, click here to know more about AWS Training.
AMI is an abbreviation for Amazon Machine Image and, as the name suggests, is simply an image of your machine or an already existing EC2 instance. So in the above-mentioned scenario, the solution would be to launch and configure your EC2 instance and then create an image or an AMI of that instance to create other instances with exactly the same configurations. AMI is used to create an image of the system or the instance to save the configuration of that instance. But, what about the database volume? Here, AWS has introduced snapshots as a backup solution for database volume associated with the EC2 instance. So, basically, a snapshot is a copy of the data; whereas, an AMI is an executable image of your EC2 servers.
Difference Between AMIs and Snapshots
Amazon offers a data storage service to use with Amazon EC2 instances, namely, Elastic Block Store (EBS). Snapshots are the backup of the data residing on EBS. So, one of the differences between a snapshot and an AMI is the type of Amazon service they are associated with. Snapshots are associated with EBS volumes and AMIs are associated with EC2 instances. Let’s take a look at the following table to understand how snapshots are different from AMIs.
|Snapshot is a non-bootable copy of the data on EBS volume||AMI is a bootable copy or an image of your whole instance|
|It is used as a backup solution for data volume of an EC2 instance||AMI is used to save the instance configuration|
|It’s not possible to take a snapshot of non-EBS backed instances||AMI of a non-EBS backed instance can be created|
Moving forward, let’s see how AMIs and snapshots are used for increasing the availability of instances.
What Is Auto Scaling in AWS?
As mentioned earlier, to deal with the failure and latency issues coming up due to the increased load on servers, autoscaling service was introduced by AWS. But, what is auto scaling in AWS? How does it work? Well, let’s check out.
AWS Auto Scaling is exactly what you can understand from its name, a service that automatically manages and adjusts compute resources to maintain a consistent performance of applications, whether it involves scaling up or scaling down the resources. AWS Auto scaling service makes sure that there are enough instances or resources to run the application without any failure.
Want to read more about AWS? Go through this AWS Tutorial!
When a situation arises where servers get overburdened due to the increased load on the application, the AWS auto scaling service will scale up the servers by creating more servers with exactly the same configurations. This is where AMIs come into the picture. An AMI is created for the server on which the application is being hosted. This AMI is used to deploy more servers.
You can also create an AWS auto scaling group, which is basically a collection of instances for the sole purpose of AWS auto scaling. The size or the capacity of the AWS auto scaling group can be managed through the scaling policy.
Moving forward with this what is auto scaling in AWS blog, let’s look at the scaling plans offered by AWS.
Maintaining current instance level at all times: With this scaling plan, the user can configure an AWS auto scaling group to maintain a fixed number of running instances at all times.
Manual scaling: This scaling plan lets the user specify the desired capacity of the AWS auto scaling groups, and the auto scaling service manages the process of creating or terminating instances on its own.
Scaling based on a schedule: This scaling plan comes in handy in situations where the user can predict when the traffic on the application is going to increase. In such cases, the user can schedule the time when AWS auto scaling should be executed.
Scaling based on demand: This scaling plan lets the user define parameters that control the scaling procedure such as CPU utilization, memory, etc.
There is a total of two steps to configure auto scaling properties:
- First is to create a launch configuration
- Second is to create an AWS auto scaling group
A launch configuration is a template used by AWS auto scaling groups that specify what kind of OS configuration should be used in the servers launched during auto scaling. Before getting started with launch configuration, you will have to create an AMI of an existing EC2.
Are you preparing for AWS interview? Then here are latest AWS interview questions
Creating an AMI
Step 1: Go to your running instances and select the instance for which you want to create an AMI. Then, go to Actions > Image > Create Image
Step 2: Provide a name for your image and leave the rest of the settings on that page as they are, and then click on Create Image
Step 3: The image request will be taken. You can verify that you have created an AMI by going to the AMIs section
Your AMI is created successfully!
Get certified from top AWS course in Melbourne Now!
Step 1: Go to the Launch Configurations section and click on Create launch configuration
Step 2: Go to My AMIs, name the launch configuration and move to the next option. Keep all the default settings as they are until you reach the Create Launch Configuration option
Step 3: When you finally click on Create Launch Configuration after reviewing all configurations, it will ask you to create a key pair. You can choose an existing key pair if you already have one, and that is it!
You have created a launch configuration successfully!
The next step is to create an AWS auto scaling group to specify under what conditions auto scaling should be done.
Creating Auto Scaling Groups in AWS
Step 1: Click on the create an auto scaling group option that appears on the screen just as you complete creating a launch configuration. The following page will open, and it will automatically pick the launch configuration that you have created. Provide a name for the auto scaling group and leave the rest of the default settings just as they are. Select a minimum of two default subnets and click on Next: Configure scaling policies
Step 2: In this screen, select ‘Use scaling policies to adjust the capacity of this group’ and provide a number in Target value so that if the average CPU utilization goes beyond the target value, a new server is launched. Or, you can keep the group at its initial size by choosing the first option
Step 3: In this demo, the first option is selected. Now, click on Next: Configure Notifications, where you don’t have to configure anything, and keep going until you reach the option to create an autoscaling group after reviewing all configurations. Click on it and your AWS auto scaling group will be created
While configuring scaling policies, you can specify more policies according to your needs such as scaling down in case the CPU utilization goes below the target value and more.
With all these setups and configurations for auto scaling in place, there will be fewer chances of your application experiencing a downtime. With this, this blog on “what is auto scaling in AWS” comes to the end. Hopefully, you got to learn something from this blog. Keep visiting to learn more about AWS!
If you have any doubts or queries related to AWS, do post on AWS Community.
- AWS Solution Architect Certification
- AWS vs Azure vs Google – Detailed Cloud Comparison
- AWS Vs Google Cloud – Detailed Comparison