Auto Scaling Group with Dynamic CPU-Based Scaling
Topics: Auto Scaling Groups, Launch Templates, CloudWatch Alarms, Dynamic Scaling Policies, Stress Testing, High Availability
Overview
Auto Scaling Groups (ASG) automate the process of dynamically adjusting capacity based on real-time demand. When CPU utilization exceeds thresholds, ASG automatically launches new instances; when demand decreases, ASG terminates excess instances to reduce costs.
This comprehensive lab demonstrates building auto-scaling architecture. You'll create a Launch Template defining instance configuration, configure an Auto Scaling Group with minimum/maximum capacity constraints, integrate with Application Load Balancer for traffic distribution, create CloudWatch Alarms to monitor CPU metrics, attach dynamic scaling policies that respond to alarms, and validate the entire system through stress testing.
Key Concepts
| Concept | Description |
|---|---|
| Auto Scaling Group (ASG) | AWS service that automatically adjusts the number of EC2 instances based on demand, health checks, and scaling policies |
| Launch Template | Reusable configuration blueprint specifying AMI, instance type, key pair, security groups, and user data for launching instances |
| Desired Capacity | Target number of instances ASG attempts to maintain; can change dynamically based on scaling policies |
| Minimum Capacity | Lowest number of instances ASG will maintain; prevents scaling below this threshold even under zero load |
| Maximum Capacity | Highest number of instances ASG can launch; prevents runaway scaling and controls maximum costs |
| Scaling Policy | Rules defining when and how to add or remove instances (Simple Scaling, Step Scaling, Target Tracking) |
| Simple Scaling | Policy that adds or removes fixed number of instances when CloudWatch alarm triggers (one action per alarm) |
| CloudWatch Alarm | Automated monitoring that triggers actions when metrics exceed thresholds for specified duration |
| Scale-Out | Process of adding instances to handle increased load (horizontal scaling up) |
| Scale-In | Process of removing instances when load decreases (horizontal scaling down) |
| Cooldown Period | Wait time after scaling activity before ASG can initiate another scaling action (prevents oscillation) |
| Health Check Grace Period | Time ASG waits before checking instance health after launch (allows application startup time) |
| Target Group Integration | ASG automatically registers new instances with load balancer target groups for seamless traffic distribution |
Prerequisites
- Completed Lab 12 (Load-Balanced Web Application with ALB and Custom AMI)
- Completed Lab 13 (Stress Testing EC2 Instance)
- Existing resources:
- Custom AMI with Apache web server and custom homepage
- Application Load Balancer (ALB) in active state
- Target Group configured for HTTP port 80
- VPC with at least 2 public subnets in different Availability Zones
- Security group allowing SSH (22) and HTTP (80)
- EC2 key pair for SSH access
- Understanding of CloudWatch metrics and alarms
- Familiarity with stress-ng tool for CPU load testing
- IAM permissions for Auto Scaling, CloudWatch, and EC2
Architecture Overview
Click to expand Architecture Diagram
Click to expand Architecture Diagram
Phase 1: Create Launch Template
Launch Templates define the instance configuration that ASG uses when launching new instances.
Sign in to AWS Management Console.
Navigate to EC2 service.
In left navigation, scroll down to Instances section → Click Launch Templates.
Click Create launch template button.
Configure template details:
- Launch template name:
LT-WebServer - Template version description: "Web server template for Auto Scaling"
- Auto Scaling guidance: Check "Provide guidance to help me set up a template that I can use with EC2 Auto Scaling"
- Launch template name:
Configure Application and OS Images (AMI):
- Click My AMIs tab
- Select your custom AMI:
WebServer-AMI(created in Lab 12) - Verify it shows the correct AMI ID
AMI Selection
You must select the custom AMI containing your pre-configured web server. If you launch from base Amazon Linux AMI, instances won't have Apache installed and won't serve web pages correctly.
Configure Instance type:
- Instance type:
t3.micro - 2 vCPUs, 1 GB RAM
- Instance type:
Configure Key pair:
- Key pair name: Select your existing key pair (e.g.,
my-key-pair.pem) - Required for SSH troubleshooting
- Key pair name: Select your existing key pair (e.g.,
Configure Network settings:
- Subnet: Don't include in launch template
- ASG will select subnets automatically based on ASG configuration
- This provides flexibility for multi-AZ deployment
- Firewall (security groups): Select existing security group
- Choose security group allowing HTTP (80) and SSH (22)
- Subnet: Don't include in launch template
Configure Storage:
- Volume 1 (AMI Root):
- Size: 8 GiB
- Volume type: gp3
- Delete on termination: Yes (recommended)
- Volume 1 (AMI Root):
Review all settings:
- Verify AMI is your custom web server image
- Verify instance type is t3.micro
- Verify security group allows HTTP and SSH
- Verify storage configured correctly
Click Create launch template.
Verify creation:
- Success message appears
- Template shows in Launch Templates list
- Status: Available
- Note the template ID (lt-xxxxxxxxxxxxx)
Launch Template vs Launch Configuration
Launch Templates are the modern replacement for Launch Configurations. They support versioning, allow modifications, can launch instances directly, and are recommended by AWS. Launch Configurations are legacy and should not be used for new deployments.
Phase 2: Create Auto Scaling Group
Configure the ASG to automatically manage instance count based on demand.
In EC2 console left navigation, scroll down to Auto Scaling section → Click Auto Scaling Groups.
Click Create Auto Scaling group button.
Step 1: Choose Launch Template
Configure ASG name and template:
- Auto Scaling group name:
ASG-WebServer - Launch template: Select
LT-WebServer - Version: Latest (recommended for automatic updates)
- Auto Scaling group name:
Click Next.
Step 2: Choose Instance Launch Options
Configure network:
- VPC: Select your VPC (Default VPC or custom VPC from Lab 10)
- Availability Zones and subnets: Select at least 2 subnets
- Choose subnets in different Availability Zones (e.g., us-east-1a, us-east-1b)
- Select public subnets (with route to Internet Gateway)
- This ensures high availability across multiple data centers
Click Next.
Step 3: Configure Advanced Options
- Load balancing configuration:
- Load balancing: Choose "Attach to an existing load balancer"
- Choose from your load balancer target groups: Select option
- Existing load balancer target groups: Select
WebApp-TG(created in Lab 12)
Target Group Registration
ASG automatically registers new instances with the Target Group. When ASG launches instances, they're immediately added to the Target Group. ALB performs health checks and starts routing traffic once instances pass health checks.
- Health checks:
- Health check type:
- Check ☑ EC2 (checks instance status)
- Check ☑ ELB (checks application health via load balancer)
- Health check grace period: 300 seconds (5 minutes)
- Allows time for Apache to start before health checks begin
- Health check type:
Health Check Grace Period
300 seconds prevents ASG from terminating instances before they finish initializing. If set too low (e.g., 60 seconds), ASG may terminate instances while Apache is still starting, creating a "launch-terminate loop." If instances use UserData scripts, increase to 600+ seconds.
Additional settings (optional):
- Enable group metrics collection within CloudWatch: Check this box
- Provides additional ASG-level metrics (GroupDesiredCapacity, GroupInServiceInstances)
- Default instance warmup: 60 seconds
- Enable group metrics collection within CloudWatch: Check this box
Click Next.
Step 4: Configure Group Size and Scaling Policies
- Group size configuration:
- Desired capacity: 1
- Number of instances ASG launches immediately
- Minimum capacity: 1
- ASG will never scale below 1 instance
- Ensures at least one instance always running
- Maximum capacity: 3
- ASG will never scale above 3 instances
- Prevents runaway costs if alarms malfunction
- Desired capacity: 1
Capacity Explanation
- Minimum = 1: Ensures website always available (at least 1 instance)
- Desired = 1: Start with 1 instance (baseline capacity)
- Maximum = 3: Allow scaling to 3 instances during high load
- If desired=2, ASG launches 2 instances immediately
- Scaling policies:
- Scaling policies: Select "No scaling policies"
- We'll add scaling policies separately in Phase 3
Why Skip Scaling Policies Here
AWS offers Target Tracking Scaling (simple setup) in this wizard, but we're using Simple Scaling with CloudWatch Alarms for educational purposes to understand the complete workflow. In production, Target Tracking is often preferred for its simplicity.
Instance maintenance policy:
- Leave default settings
Click Next.
Step 5: Review and Create
Review all configuration:
- Launch template: LT-WebServer
- VPC and subnets: 2+ subnets in different AZs
- Load balancer: Attached to WebApp-TG
- Group size: Min=1, Desired=1, Max=3
- Health checks: EC2 + ELB enabled
Click Create Auto Scaling group.
Verify ASG created successfully:
- Navigate to Auto Scaling Groups
ASG-WebServerappears in list- Status: Shows capacity information
Phase 2 Verification
Check Activity tab:
- Shows "Launching a new EC2 instance" activity
- Wait for status: "Successful"
Check Instance management tab:
- Shows 1 instance in "InService" lifecycle state
- Health status: "Healthy" (may take 3-5 minutes)
Navigate to EC2 → Instances:
- See new instance launched by ASG
- Name includes ASG name (e.g., "ASG-WebServer")
- Instance state: Running
Navigate to Target Groups → Select WebApp-TG → Targets tab:
- Instance registered automatically
- Health status: "Healthy" (wait 30-60 seconds for health checks)
Test ALB DNS name in browser:
- Should display your custom web page
- Refresh multiple times (will show same instance since only 1 running)
First Instance Launch
ASG launches the first instance to meet desired capacity (1). This happens automatically—you don't manually register instances. The instance appears in both EC2 Instances list and Target Group targets.
Phase 3: Create CloudWatch Alarms for Scaling
Create alarms that monitor CPU and trigger scaling policies.
Create High CPU Alarm (Scale-Out Trigger)
Navigate to CloudWatch service.
In left navigation, click Alarms → All alarms.
Click Create alarm button.
Click Select metric.
Select metric source:
- Click EC2
- Click By Auto Scaling Group
- Find and check CPUUtilization for
ASG-WebServer - Click Select metric
Metric Selection
Select "By Auto Scaling Group" (not "Per-Instance Metrics"). This monitors the average CPU across all instances in the ASG, which is the correct metric for scaling decisions.
- Configure metric and conditions:
- Statistic: Average
- Period: 1 minute
- How often CloudWatch evaluates the condition
- Shorter period = faster scaling response
- Conditions:
- Threshold type: Static
- Whenever CPUUtilization is: Greater than 60
- Threshold value: 60
Threshold Selection
- 60% threshold: Moderate load, typical for scale-out
- Lower threshold (40%): More aggressive scaling, higher costs
- Higher threshold (80%): Slower scaling, may impact performance
- Adjust based on your application's requirements
Click Next.
Configure actions:
- Alarm state trigger: In alarm
- Send a notification to: Select "Remove"
- We don't need SNS notifications for this lab
- Auto Scaling action: Skip (we'll attach scaling policy separately)
No Actions Configuration
Don't configure any actions on this screen. We'll create scaling policies separately and link them to the alarms. If you see a warning "No actions configured," click Proceed without actions.
Click Next.
Configure alarm name:
- Alarm name:
ASG-CPU-High-60 - Alarm description: "Trigger scale-out when CPU > 60%"
- Alarm name:
Click Next.
Review configuration:
- Metric: ASG-WebServer CPUUtilization
- Condition: Average > 60 for 1 minute
- Actions: None (will add via scaling policy)
Click Create alarm.
Verify alarm created:
- Shows in Alarms list
- State: "OK" (CPU below 60%)
- Or "Insufficient data" (wait 1-2 minutes for first data point)
Create Low CPU Alarm (Scale-In Trigger)
In CloudWatch Alarms, click Create alarm again.
Click Select metric → EC2 → By Auto Scaling Group.
Check CPUUtilization for
ASG-WebServer→ Click Select metric.Configure metric and conditions:
- Statistic: Average
- Period: 1 minute
- Conditions:
- Threshold type: Static
- Whenever CPUUtilization is: Lower than 20
- Threshold value: 20
Scale-In Threshold
- 20% threshold: Conservative scale-in, keeps instances longer
- Higher threshold (40%): Aggressive scale-in, reduces costs faster
- Set lower than scale-out threshold to create "hysteresis" (prevents oscillation)
Click Next.
Configure actions:
- Skip SNS notification
- Skip Auto Scaling action
- Click Proceed without actions
Click Next.
Configure alarm name:
- Alarm name:
ASG-CPU-Low-20 - Alarm description: "Trigger scale-in when CPU < 20%"
- Alarm name:
Click Next → Review → Click Create alarm.
Verify both alarms exist:
ASG-CPU-High-60(State: OK or Insufficient data)ASG-CPU-Low-20(State: OK or Insufficient data)
Phase 4: Create and Attach Scaling Policies
Link the CloudWatch alarms to Auto Scaling actions.
Create Scale-Out Policy (Add Instances)
Navigate to EC2 → Auto Scaling Groups.
Select
ASG-WebServer.Click Automatic scaling tab.
Under Dynamic scaling policies, click Create dynamic scaling policy button.
Configure policy:
- Policy type: Simple scaling
- Adds/removes fixed number of instances per alarm trigger
- Scaling policy name:
ScaleOut-CPU60 - CloudWatch alarm: Select
ASG-CPU-High-60 - Take the action: Add
- Capacity units: 1
- Adds 1 instance when alarm triggers
- And then wait: 300 seconds
- Cooldown period before next scaling action
- Policy type: Simple scaling
Cooldown Period
300 seconds (5 minutes) prevents rapid successive scaling. After adding instance, ASG waits 5 minutes before considering another scale-out, allowing the new instance to start serving traffic and metrics to stabilize.
Click Create button.
Verify policy created:
- Shows in Dynamic scaling policies list
- Policy name: ScaleOut-CPU60
- Alarm: ASG-CPU-High-60
Create Scale-In Policy (Remove Instances)
Still in Automatic scaling tab, click Create dynamic scaling policy again.
Configure policy:
- Policy type: Simple scaling
- Scaling policy name:
ScaleIn-CPU20 - CloudWatch alarm: Select
ASG-CPU-Low-20 - Take the action: Remove
- Capacity units: 1
- Removes 1 instance when alarm triggers
- And then wait: 300 seconds
Click Create button.
Verify both policies exist:
- ScaleOut-CPU60 (adds 1 when CPU > 60%)
- ScaleIn-CPU20 (removes 1 when CPU < 20%)
Policy Status
Policies show "Waiting" status initially. They activate when the linked CloudWatch alarms change state (OK → ALARM).
Phase 5: Install Stress Testing Tool
Prepare to validate Auto Scaling by generating CPU load.
Navigate to EC2 → Instances.
Find the instance launched by ASG:
- Look for instance with ASG name in tags
- Or check ASG → Instance management tab for instance ID
Select the instance → Click Connect.
Use EC2 Instance Connect or SSH:
- For SSH:
ssh -i your-key.pem ec2-user@<Public-IP>
- For SSH:
Update system and install stress-ng:
bashsudo dnf update -y sudo dnf install stress-ng -yVerify installation:
bashstress-ng --version
VPC Internet Access Required
If dnf install fails with "Cannot download," ensure:
- Instance is in public subnet with route to Internet Gateway
- Or in private subnet with route to NAT Gateway
- Security group allows outbound HTTPS (443) for package downloads
Phase 6: Trigger Scale-Out Event
Generate high CPU load to trigger automatic scaling.
Run Stress Test
While connected to ASG instance via SSH:
bashstress-ng --cpu 4 --timeout 300- Creates 4 CPU workers
- Runs for 5 minutes (300 seconds)
- Pushes CPU to 90-100%
Monitor command output:
stress-ng: info: [xxxxx] dispatching hogs: 4 cpu stress-ng: info: [xxxxx] cache allocate: using defaults...Keep SSH session open or run in background:
bash# Run in background nohup stress-ng --cpu 4 --timeout 300 & # Logout (stress continues) exit
Monitor CloudWatch Alarm
Navigate to CloudWatch → Alarms.
Watch
ASG-CPU-High-60alarm:- Initial state: OK (CPU < 60%)
- After 1-2 minutes: State changes to ALARM (CPU > 60%)
- Red color indicates alarm triggered
Observe alarm graph:
- CPU line crosses 60% threshold
- Alarm evaluates true for 1 datapoint
- State change: OK → ALARM
Monitor Auto Scaling Activity
Navigate to EC2 → Auto Scaling Groups → Select
ASG-WebServer.Click Activity tab.
Watch for new activity:
- Status: "Launching a new EC2 instance"
- Cause: "At 2026-01-17 10:23:00 UTC a monitor alarm arn:aws:cloudwatch:... in ALARM state triggered policy ScaleOut-CPU60"
- Shows which alarm triggered the scaling
Wait 2-4 minutes:
- Activity status changes to: Successful
- Message: "Launching a new EC2 instance: i-xxxxxxxxx"
Click Instance management tab:
- Now shows 2 instances in "InService" state
- Desired capacity automatically increased from 1 to 2
Navigate to EC2 → Instances:
- See 2 instances running with ASG name
- New instance just launched
Navigate to Target Groups → Select
WebApp-TG→ Targets tab:- Shows 2 registered targets
- New instance initially "Initial" status
- Wait 30-60 seconds → Both show "Healthy"
Scaling Timeline
- T+0 min: Stress test starts, CPU rises
- T+1 min: CloudWatch alarm triggers (ALARM state)
- T+1 min: ASG initiates scale-out
- T+2 min: New instance launching
- T+3 min: Instance running, registered with Target Group
- T+4 min: Instance passes health checks, receives traffic
Test Load Balancing Across 2 Instances
Copy ALB DNS name.
Open browser → Navigate to ALB DNS:
http://WebApp-ALB-xxxxx.us-east-1.elb.amazonaws.comRefresh browser multiple times:
- First refresh: Shows Instance 1 hostname
- Second refresh: Shows Instance 2 hostname
- Third refresh: Shows Instance 1 hostname
- Load balancing confirmed!
Browser Caching
If you see the same instance repeatedly, clear browser cache or use incognito mode. Some browsers cache responses aggressively.
Phase 7: Trigger Scale-In Event
Allow CPU to drop and observe automatic instance termination.
Stop Stress Test
If stress test still running, SSH to instance:
bash# Find stress-ng process ps aux | grep stress-ng # Kill it if needed sudo pkill stress-ngOr wait for 5-minute timeout to complete automatically.
Monitor CPU Drop
Navigate to CloudWatch → Alarms.
Watch
ASG-CPU-High-60alarm:- After stress stops: CPU drops below 60%
- State changes: ALARM → OK
Watch
ASG-CPU-Low-20alarm:- After 2-3 minutes of idle: CPU drops below 20%
- State changes: OK → ALARM
Monitor Scale-In Activity
Navigate to Auto Scaling Groups → Select
ASG-WebServer→ Activity tab.Wait 3-5 minutes after CPU drops below 20%:
- New activity appears: "Terminating EC2 instance"
- Cause: "At 2026-01-17 10:35:00 UTC a monitor alarm arn:aws:cloudwatch:... in ALARM state triggered policy ScaleIn-CPU20"
Wait for activity status: Successful
Click Instance management tab:
- Now shows 1 instance in "InService"
- Desired capacity automatically decreased from 2 to 1
Navigate to EC2 → Instances:
- One instance terminated (state: Terminating or Terminated)
- One instance running (minimum capacity maintained)
Navigate to Target Groups → Targets tab:
- Shows 1 healthy target
- Terminated instance shows "Draining" then disappears
Scale-In Timing
Scale-in is intentionally slower than scale-out:
- CloudWatch must detect low CPU for evaluation period
- Cooldown period prevents premature termination
- Total time: 5-10 minutes from stress stop to termination
- This prevents oscillation (rapid add/remove cycles)
Validation
Validation
Verify all components working correctly:
Launch Template:
- Template
LT-WebServerexists with correct AMI - Instance type: t3.micro
- Security group allows HTTP (80) and SSH (22)
- Template version shows "Latest" or specific version number
- Template
Auto Scaling Group:
- ASG
ASG-WebServercreated and active - Capacity: Min=1, Desired=1-2, Max=3
- Attached to Target Group: WebApp-TG
- Health check type: EC2 + ELB
- Covers 2+ Availability Zones
- ASG
CloudWatch Alarms:
ASG-CPU-High-60exists (triggers at CPU > 60%)ASG-CPU-Low-20exists (triggers at CPU < 20%)- Both alarms monitor ASG average CPU (not individual instances)
- Alarms change state based on load (OK ↔ ALARM)
Scaling Policies:
ScaleOut-CPU60attached to high CPU alarm (adds 1 instance)ScaleIn-CPU20attached to low CPU alarm (removes 1 instance)- Cooldown period: 300 seconds configured
- Policies show in ASG Automatic scaling tab
Auto Scaling Behavior:
- Scale-out test: High CPU triggers alarm → ASG launches new instance → Instance registers with Target Group → Health checks pass → Traffic distributed
- Scale-in test: Low CPU triggers alarm → ASG terminates instance → Desired capacity reduces → Single instance remains (minimum)
- Activity history shows all scaling events with timestamps and causes
Load Balancer Integration:
- New instances automatically registered with Target Group
- Terminated instances automatically deregistered
- ALB distributes traffic across all healthy instances
- No manual Target Group management required
Cost Considerations
Cost Considerations
Auto Scaling Group Service: Free
- No charges for ASG itself, only for launched instances
EC2 Instances (Variable):
- Minimum cost (1 instance): ~$0.0104/hour = ~$7.50/month
- During scale-out (2-3 instances): ~$0.0208-$0.0312/hour
- Free Tier: 750 hours/month covers 1 instance 24/7
- After Free Tier: Pay for all running instances
Application Load Balancer:
- Hourly: ~$0.0225/hour = ~$16.20/month
- LCU charges: $0.008 per LCU-hour (minimal for lab traffic)
- No free tier for ALB
CloudWatch:
- Alarms: First 10 alarms free, then $0.10/alarm/month
- 2 alarms in this lab: Free
- Metrics (Basic Monitoring): Free for EC2 instances
- Detailed Monitoring (Optional): $2.10/instance/month
Data Transfer:
- Between AZs: $0.01/GB each direction (if instances in different AZs)
- Outbound to internet: First 100 GB free, then $0.09/GB
- ALB to instances: Free within same AZ
Total Cost Examples:
Scenario 1: 1-hour lab (Free Tier)
- 1 instance running 1 hour: $0 (free tier)
- ALB 1 hour: $0.02
- CloudWatch alarms: $0 (free)
- Total: ~$0.02
Scenario 2: 24/7 for 30 days (After Free Tier)
- 1 instance (minimum, always running): ~$7.50
- Occasional scale-out (2-3 instances for 10% of time): ~$2.25
- ALB: ~$16.20
- CloudWatch: $0 (2 alarms free)
- Total: ~$26/month
Scenario 3: High traffic with frequent scaling
- Average 2.5 instances running: ~$18.75
- ALB + LCU charges: ~$20
- Data transfer (cross-AZ): ~$2
- Total: ~$40/month
Cleanup
Cleanup
Delete resources in correct order to avoid dependency errors:
1. Delete Auto Scaling Group
Navigate to EC2 → Auto Scaling Groups.
Select
ASG-WebServer.Click Delete button.
Confirmation dialog:
- Type
deleteto confirm - Click Delete
- Type
ASG deletion triggers:
- All scaling policies deleted automatically
- All instances terminated automatically
- Target Group deregistration automatic
Wait 2-3 minutes:
- ASG removed from list
- Instances show "Terminating" then "Terminated"
ASG Deletes Instances
When you delete ASG, AWS automatically terminates all instances it manages. You don't need to manually terminate them. If you terminate instances manually first, ASG will launch new ones to maintain desired capacity.
2. Delete CloudWatch Alarms
Navigate to CloudWatch → Alarms.
Select both alarms:
ASG-CPU-High-60ASG-CPU-Low-20
Click Actions → Delete.
Confirm deletion.
3. Delete Launch Template
Navigate to EC2 → Launch Templates.
Select
LT-WebServer.Click Actions → Delete template.
Confirm deletion (type
delete).
4. Delete Application Load Balancer (If Not Needed)
Navigate to EC2 → Load Balancers.
Select
WebApp-ALB.Click Actions → Delete load balancer.
Type
confirm→ Click Delete.Wait for deletion (2-3 minutes).
5. Delete Target Group (If Not Needed)
Navigate to EC2 → Target Groups.
Select
WebApp-TG.Click Actions → Delete.
Confirm deletion.
6. Deregister AMI and Delete Snapshot (If Not Needed)
Navigate to EC2 → AMIs.
Select
WebServer-AMI.Click Actions → Deregister AMI.
Confirm deregistration.
Navigate to Snapshots.
Find snapshot associated with AMI (check description).
Select snapshot → Actions → Delete snapshot.
Confirm deletion.
7. Delete Security Groups (Optional)
Navigate to EC2 → Security Groups.
Select security groups created for this lab.
Click Actions → Delete security groups.
If error "has dependent object," wait 2-3 minutes for network interfaces to detach.
Retry deletion.
Verification
- ASG removed from Auto Scaling Groups list
- All ASG-managed instances terminated
- CloudWatch alarms deleted
- Launch Template deleted
- ALB and Target Group deleted (if applicable)
- AMI deregistered and snapshot deleted (if applicable)
- No unexpected charges in Billing dashboard (check after 24 hours)
Result
You have successfully deployed a production-ready auto-scaling infrastructure that automatically adjusts capacity based on CPU load. The system demonstrated self-healing capabilities by launching new instances during high demand and terminating excess instances during low demand, all without manual intervention.
Viva Questions
Explain the complete workflow from high CPU detection to new instance serving traffic.
Why do we need both a minimum capacity and a maximum capacity in Auto Scaling Groups?
What is the purpose of the cooldown period, and what problems does it prevent?
How does Auto Scaling Group integration with Target Group differ from manually registering instances?
What would happen if you set the scale-in threshold higher than the scale-out threshold (e.g., scale-out at 40%, scale-in at 60%)?
