Auto Scaling helps you maintain application availability and allows you to scale your Amazon EC2 capacity up or down automatically according to conditions you define such as user-defined policies, schedules, and health checks. You can define which EC2 instance you want to run with the help of auto scaling and it will ensure you that you running your desire instances.
Auto Scaling can also automatically increase the number of Amazon EC2 instances during demand spikes to maintain performance and decrease capacity during lulls to reduce costs. Auto Scaling is well suited both to applications that have stable demand patterns or that experience hourly, daily, or weekly variability in usage.
Features and Benefits
- Maintain your Amazon EC2 instance availability and Automated Provisioning
- Adjustable Capacity and Automatically Scale Your Amazon EC2 Fleet
- Reusable Instance Templates (Source: https://aws.amazon.com/autoscaling/)
Task list for the module 9:
- To enable Auto Scaling Group
- To Create launch configuration for Auto Scaling
- To Create Auto Scaling group
- To check and monitor the auto scaling on dinostore website page
- To check the auto scale testing by terminate instances
The architecture of the project:
Steps for the task: To enable Auto Scaling Group
In this task, I will demonstrate how to create auto scaling group and its configuration. You can use Auto Scaling to manage Amazon EC2 capacity automatically, maintain the right number of instances for your application, operate a healthy group of instances, and scale it according to your needs.
- You need to go AWS EC2 dashboard from services menu in the AWS console management. Choose ‘Auto Scaling Group’ from Auto Scaling.
Click “Create Auto Scaling Group“: Step 1: Create launch configuration and Step 2: Create Auto Scaling group.
Steps for the task: Create launch configuration
An AMI is a template that contains the software configuration (operating system, application server, and applications) required to launch your instance. So whenever your system needs Auto scaling, it will directly fetch the AMIs that you will mention here for creating the new instance.
- In this section, You have to choose “My AMIs”. I am going to choose “My AMIs” which I created during module 6 deployment. 2. Choose your “DinoStoreWebServer” AMI. and click on “Select” for further configuration.
3. In the configure details page, Type the name of Auto Scale “Scale-Web” and Choose IAM role that we created before “WebServerRole“. On the Add storage page, keep the storage configuration default as it is!
4. Click “Next: Configure Security Group“. Select an existing security group = WebRDPGroup. Then Click “Review“.
5. Click “Create launch configuration” and select your an existing key pair or you can create a new key pair. In this case, I chose my existing key pair.
Steps for the task: Create Auto Scaling group
In this section, I will create Auto Scaling group. An Auto Scaling group is a collection of EC2 instances and the core of the Auto Scaling service. You create an Auto Scaling group by specifying the launch configuration you want to use for launching the instances and the number of instances your group must maintain at all times. You can also mention that which Availability Zone you want to launch your instances.You can also specify the Availability Zone in which you want the instances to be launched.
- click Name the Auto Scaling Group name and your network details. Initially, we start with 2 instance group size.
2. Keep the group at its initial size. Note that you can use scaling policies if you had criteria to scale up or down beyond the two instances we have.
3. Review and click ” Create Auto Scaling Group“
4. Now you need to back in your AWS EC2 dashboard, check out that newly created Auto-scaling information to watch the instances launch. Those two “ASG-WebServer” are an auto-scaling group.
5. Now you need to check your Load Balancer. You will get there four instances, previously there were two instances registered. Now You can see four instances are registered under the Load balancer. All are up and running and status is “InService“.
Steps for the task: To check and monitor the auto scaling on dinostore website page
In this section, you will monitor the auto scaling effect on the dinostore website pages. You will refresh the page again and again so that you will able to see four different private IP address and website is still running.
- Open up your local browser with Dinostore website. Replace the URL with the Load balancer URL. Keep refreshing the page. And see the effect of auto scaling.
Steps for the task: To check the auto scale testing by terminate instances
In this section, I will terminate my two original servers including WebServer and Webserver 02 (Real-only). Those servers are not in the auto-scaling group. After terminating the server, I will check whether the website is running or not!
- In the AWS EC2 Instances window, terminate the WebServer and Webserver02
The result of Servers termination:
After terminating two original servers including WebServer and WebServer02, You will notice only two Private IP address are showing while refreshing pages.
2. Now we will test the auto scaling, terminate one of the auto-scale instances and watch what happens in both the EC2 instances window and the auto scaling groups window. You will notice that one instance will be created automatically after deleting one auto-scale group server.
The result of Auto Scale Instance termination:
You can only see one IP address after refreshing your website again and again.
And One Auto-Scale instance is automatically initiated to create.
After creating new automatic auto scaling instance. If you refresh your website, You will able to see two private IP addresses at this time.
If you check Load balancer console, you will notice that there is now another new instance is automatically registered with the status “InService“
Auto Scaling will help you to reduce the load during the rush time of your business website, Your customers will be experiences better availability services.Auto Scaling can dynamically increase and decrease capacity as needed. As you pay for the EC2 instances you use, you save money by launching instances when they are actually needed and terminating them when they aren’t needed.
It also provides you better fault tolerance, because Auto Scaling can detect when an instance is unhealthy, terminate it, and launch an instance to replace it automatically. The another benefit is that If one Availability Zone becomes unavailable, Auto Scaling can launch instances in another one to compensate.
Screencast link : https://www.youtube.com/watch?v=AkIOG5iK5ME
The next Module I will discuss “ Configuring DNS with Route 53”
Enjoy your shopping 24/7 Service on Wildlife Dino-Store website!
Thank you 🙂