What is Auto Scaling in AWS?
AWS auto scaling is a great feature that provides the ability to monitor your applications and automatically adjusts capacity to maintain steady, predictable performance at the lowest possible cost. With Auto-scaling you can scale out/in resources (servers, database, storage, etc.) automatically based on the pre-defined threshold for the metrics such as memory usage, network usage, CPU utilization.
Benefits of Auto Scaling
Cost optimization
AWS Auto scaling allows scale resources up or down through pre-defined threshold, which help you only pay for the resources you actually need. When demand drops, AWS Auto Scaling will automatically remove any excess resource capacity so you avoid overspending.
High availability
AWS Auto scaling ensures the high availability of your application by adding new resources when traffic increases and removing resources when traffic decreases.
Fault tolerance
AWS Auto scaling monitors your application which helps you to remove any corrupted increases and launch new ones automatically.
Better performance
AWS Auto scaling ensure optimal application performance and availability, even changes in traffic, workloads are periodic, and unpredictable.
Components of AWS auto-scaling
AWS Auto Scaling consists of the following components:
EC2 Instance
Amazon EC2 instance is a virtual server, that provides secure, resizable compute capacity in the cloud. EC2 instances are created from preconfigured templates known as AMI (Amazon Machine Image).
Amazon Machine Image (AMI)
An Amazon Machine Image (AMI) is a special type of pre-configured virtual machine image that is used to create virtual servers(EC2 instances) in the AWS environment. You must specify an AMI during the launch of EC2 instance. This is a faster way to setup an EC2 instance with pre-configured software, no manual setup is required.
Elastic Load balancer
AWS Elastic Load balancer is a cloud-based load balancing service, that automatically distributes incoming traffic across multiple targets, such as EC2 instances, containers, and IP addresses.
Launch Configuration
Launch configuration is an EC2 instance configuration template, that defines the instance properties such as AMI, instance type, security, etc.
Launch Template
AWS recommends to use the launch template, It is similar to a launch configuration with some additional features.
Auto Scaling Group (ASG)
An auto scaling group contains a collection of EC2 instances that are created from a launch configuration. ASG defines the number of instances running at any given time, It adds or removes instances depending on the traffic to the server.
Scaling Policies
AWS scaling policies define the rules to scale up or down the resources based on the specific CloudWatch metric alarms, scheduled action, or manual action.