Compute

Amazon EC2 Auto Scaling

View on GitHub

Amazon EC2 Auto Scaling

A service that automatically adjusts the number of Amazon EC2 instances in one or more Auto Scaling groups based on configured policies, schedules, or health checks. It operates by using launch templates or launch configurations to create and terminate instances and integrates with monitoring data to make scaling decisions. It normally fits in the compute layer of an AWS architecture to provide elasticity for workloads running on EC2 instances.

🗂 Resource Category

Compute • Management and Governance

🧠 Exam Memory Hook

Think: "Instance fleet scaling + metric or schedule triggers + ALB integration = Amazon EC2 Auto Scaling"


📖 Ownership

Classification: AWS Managed Service

AWS responsibilities: AWS operates and maintains the Auto Scaling control plane, APIs, scaling engine, and the underlying physical infrastructure and hypervisor used to run the control plane and EC2 instances. AWS secures and patches the AWS-owned infrastructure and the managed service platform components that implement Auto Scaling. AWS provides regional availability for the Auto Scaling APIs and ensures the control plane is available according to AWS service management.

Customer responsibilities: The customer configures Auto Scaling groups, launch templates or launch configurations, scaling policies (target tracking, step, or scheduled), health check settings, lifecycle hooks, instance AMIs, instance roles and permissions, VPC/subnet placement, security groups, and any automation triggered by scaling events. The customer is responsible for securing EC2 instances, application code, monitoring metrics and alarms, and implementing remediation or deployment processes for instances created by Auto Scaling.

Patching responsibilities: AWS patches the physical infrastructure and the hypervisor. The customer patches the guest operating system, installed runtimes, libraries, dependencies, and customer applications running on EC2 instances launched by Auto Scaling. There is no managed runtime patching by Auto Scaling; the service only manages instance lifecycle and capacity, not the contents of instances.


🏗 Typical Architecture

💡 Top 5 Features

  • Auto Scaling groups that maintain a desired number of EC2 instances across one or more Availability Zones.
  • Multiple scaling policy types including target tracking, step scaling, and scheduled scaling to adjust capacity based on metrics or time.
  • Integration with launch templates and launch configurations to define instance AMI, instance type, user data, and networking.
  • Health check evaluation and automatic replacement of unhealthy instances when integrated with ELB health checks or EC2 status checks.
  • Lifecycle hooks that pause instance launch or termination to run custom initialization or cleanup actions.

✅ Top 5 Use Cases

  • Scaling a web server fleet behind an Application Load Balancer to handle variable user traffic while maintaining availability across AZs.
  • Scaling worker fleets that process messages from Amazon SQS or jobs from a queue to match throughput demand.
  • Using scheduled scaling for predictable traffic patterns such as business hours or planned batch windows.
  • Implementing mixed instance policies to combine On-Demand and Spot capacity for cost-optimized, resilient compute fleets.
  • Automatically replacing failed or degraded instances to maintain a target capacity and improve fault tolerance.

🏗 Architecture Placement

Amazon EC2 Auto Scaling sits in the compute management layer; Auto Scaling groups launch and terminate EC2 instances into specified VPC subnets and Availability Zones. Traffic typically flows from a load balancer or event/queue source to instances managed by Auto Scaling, and scaling decisions are driven by Amazon CloudWatch metrics, schedules, or other policy triggers. The service is regional and configured per account and VPC.

🎯 Commonly Used With

- Amazon EC2
- Amazon VPC
- Elastic Load Balancing
- Amazon CloudWatch
- AWS Identity and Access Management

🌍 5 Real-World Examples

  • An e-commerce platform uses Auto Scaling to increase the number of web servers during peak shopping hours and reduce capacity overnight to control costs.
  • A media processing pipeline scales a fleet of EC2 transcoding instances based on the depth of a processing queue to meet variable workload demand.
  • A financial batch job environment scales worker instances on a schedule to run end-of-day calculations while keeping resources minimized during the day.
  • A healthcare appointment booking API scales the application tier across Availability Zones using Auto Scaling to maintain capacity during surge events.
  • A telecommunications API tier uses mixed instance policies in Auto Scaling groups to combine Spot and On-Demand instances for cost-effective capacity.

🎓 AWS Exam Clues

  • Use Auto Scaling when you need automatic vertical-sized capacity adjustments for EC2 instance fleets using policies or schedules.
  • Prefer Auto Scaling for workloads requiring full OS access and custom software on instances rather than serverless alternatives.
  • If the question mentions target tracking or step scaling based on CloudWatch metrics, Auto Scaling groups are likely relevant.
  • When replacement of unhealthy EC2 instances or lifecycle hooks for bootstrapping are required, Auto Scaling provides native support.
  • If scaling must be coordinated with an Application Load Balancer or multi-AZ distribution, Auto Scaling groups integrate directly.

📝 Quick Revision

Amazon EC2 Auto Scaling automatically adjusts EC2 instance capacity using Auto Scaling groups, scaling policies, and lifecycle hooks. Use it when you need fleet-level instance control, per-instance patching responsibilities, health-checked replacement, cross-AZ distribution, and integration with CloudWatch and load balancers.

🏷 Keywords

Auto Scaling grouplaunch templatelaunch configurationscaling policytarget trackingstep scalingscheduled scalinglifecycle hookhealth checkmixed instances policyinstance refreshEC2 instance lifecycle