Auto Scaling desired capacity and policies
Why a fixed server count is not enough
Imagine a bookstore with two EC2 instances. At lunch the number of shoppers doubles. Adding a third or fourth instance can spread the work; removing unneeded instances later saves compute usage. An Auto Scaling group (ASG) maintains a chosen amount of EC2 capacity and can adjust it using policies. This is horizontal scaling: adding machines rather than increasing the size of one machine. It does not automatically make a database faster or make a stateful application safe to duplicate.
Launch template and capacity bounds
A launch template describes how to start an instance: AMI, instance type, security groups, instance profile, storage and boot configuration. Pin a reviewed template version for reproducible changes. Select subnets in two Availability Zones (AZs) for the group. In this example all instances count as one capacity unit. Minimum and maximum bound ordinary dynamic scaling; desired capacity is the target, not a count of ready servers. Replacements and certain maintenance settings can temporarily exceed ordinary limits. Check pending and healthy capacity separately.
min=2, desired=3, max=6ready=2, pending=1Choose a scaling policy
Target tracking adjusts capacity toward a metric target, for example average CPU at 50% if CPU reflects demand. Step scaling chooses an adjustment from the size of an alarm breach. Scheduled scaling is useful for predictable events; dynamic policies can react to unexpected traffic. For an application bottlenecked by a database, adding web servers may increase pressure instead of fixing latency. Use metrics related to capacity, and inspect saturation and errors. The next worksheet assumes each ready instance can safely serve 100 requests per second; it is not the AWS target tracking algorithm.
demand=350 requests/sceil(350/100)=4clamp(4, 2, 6)=4demand=750 -> desired=6; unmet=150 requests/sWarmup and cooldown
A new instance may boot before its application reaches stable performance. Default instance warmup helps dynamic policies avoid interpreting unstable new-instance metrics as steady capacity; it affects when metrics contribute and scale-in behavior. Cooldown is particularly relevant to simple scaling and is not the same timer as warmup or health-check grace. Set timings using measured boot and application behavior. A launch lifecycle hook can hold an instance while initialization finishes; use bounded waits and handle failure. A group at its maximum may need a reviewed capacity change or demand reduction, not endless retries.
Plan cost and practice
For an invented rate of $0.04 per instance-hour, one instance for 24 hours costs $0.96 in compute; two cost $1.92. This omits storage, load balancer, transfer, logs, taxes and other charges. Two zones reduce some failure risks but do not guarantee uptime. Keep session state outside replaceable instances where the application permits it. Practice: for 40, 350 and 750 requests/s, calculate bounded desired capacity and unmet demand using the worksheet. Compare with the lab answer and explain what happens while new instances are pending. No account is needed.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Auto Scaling desired capacity and policies — knowledge check
Apply the fictional bookstore scaling and delivery design.
Desired capacity is 4, with two ready and two pending. What can serve work now?
With min 2, max 6 and 100 requests/s per ready instance, how many units does the worksheet request for 350 requests/s?
Which policy aims to maintain average CPU near a selected target?
Demand is 750 requests/s, max is 6, and each instance can handle 100 requests/s. What remains unmet at full ready capacity?
Why configure a default warmup?