SaveMyCert
Log in
2 of 2 free questions left today·for 5 a day
Reliability and Business Continuity

Auto Scaling and Elasticity: EC2, Caching, and Database Scaling

24 min readSOA-C03 · Reliability and Business ContinuityUpdated

Elasticity is the ability of a workload to add capacity automatically when demand rises and shed it when demand falls, keeping performance steady without paying for idle resources. Task 2.1 of the SOA-C03 exam tests whether you can operate that machinery: EC2 Auto Scaling groups and their policy types, the metrics those policies track, warmup, cooldown and scale-in controls, scaling for ECS services and Lambda functions, the caching layers (CloudFront and ElastiCache) that absorb load before it reaches your compute, and the scaling controls built into RDS, Aurora and DynamoDB. The questions are operational, not architectural: a group that launches and terminates instances in a loop, an alarm in breach with nothing launching, a cache whose hit rate keeps falling, a read replica falling behind, a DynamoDB table throttling writes. This lesson works through the scaling mechanisms for the compute, cache and database tiers, compares the near-twin controls the exam likes to set against each other, and walks through the troubleshooting patterns its scenarios come from.

What you’ll learn

  • Configure EC2 Auto Scaling groups with launch templates, min/max/desired capacity, health-check type and grace period
  • Choose the right scaling policy (target tracking, step, simple, scheduled or predictive) and the right metric for it, including request count per target and SQS backlog per instance
  • Explain how instance warmup, the default cooldown, scale-in protection, termination policies and lifecycle hooks interact
  • Diagnose flapping, stuck-at-max capacity, launch failures and suspended processes in an Auto Scaling group
  • Scale ECS services across both the task and the instance layer, and choose between Lambda reserved and provisioned concurrency
  • Use CloudFront cache policies, Origin Shield and ElastiCache (Valkey, Redis OSS, Memcached, Serverless) to offload traffic, and read cache metrics such as Evictions and EngineCPUUtilization
  • Scale RDS, Aurora and DynamoDB with instance class changes, storage autoscaling, read replicas, the right Aurora endpoint, capacity modes and DAX

The 11 parts · about 17 min of reading

  1. How an EC2 Auto Scaling group keeps capacity rightStart hereMin, max and desired capacity, versioned launch templates, mixed instances, ELB health checks and a grace period matching startup.2 min
  2. Scaling policy types comparedTarget tracking, step, simple, scheduled and predictive policies, and why a scheduled action should raise the minimum, not just desired.2 min
  3. Choosing the metric for target trackingTarget tracking needs a metric that falls as capacity grows: CPU, ALBRequestCountPerTarget, or SQS backlog per instance in messages.1 min
  4. Cooldowns, instance warmup, and lifecycle hooksThe default cooldown governs only simple scaling, instance warmup governs target tracking and step, and lifecycle hooks pause launches.1 min
  5. Controlling scale-inScale-in protection decides eligibility, the termination policy picks the instance, and a hook only delays it, with heartbeat limits.2 min
  6. Troubleshooting: flapping, stuck at max, and suspended processesFix flapping with target tracking and warmup, then diagnose an alarm with no launches: no headroom, failed launches or suspended processes.2 min
  7. Scaling beyond EC2ECS needs service scaling plus a managed-scaling capacity provider on EC2; Lambda is tuned with reserved and provisioned concurrency.1 min
  8. Caching for dynamic scalabilityCloudFront cache keys, origin request policies and Origin Shield cut origin load; ElastiCache engines differ in replication and failover.2 min
  9. ElastiCache topology, metrics, and scalingReplicas scale reads, shards scale writes and memory, and Evictions, Reclaimed and EngineCPUUtilization reveal what a cache needs.1 min
  10. Scaling RDS and AuroraResize RDS with a brief Multi-AZ failover, add replicas for reads, and reach auto-scaled Aurora Replicas through the reader endpoint.2 min
  11. Scaling DynamoDBOn-demand absorbs spikes while provisioned auto scaling suits steady load; throttling points to the mode, a hot key, or a need for DAX.1 min

Mind map

Min blocks scale-in, max blocksscale-outLaunch templates are versioned forroll backAdd ELB health checks behind a loadbalancerGrace period longer than real startuptime1✓Group capacity and healthTarget tracking is the default, leastconfigStep scaling sizes the response to thebreachScheduled action should raise min, notdesiredPredictive: forecast only mode first2✓Five policy typesMetric must fall as capacity is addedALBRequestCountPerTarget for I/O-boundfleetsNever total RequestCountSQS: backlog per instance, target inmessages3✓Picking the trackedmetricDefault cooldown (300 s) is simplescaling onlyWarmup keeps new instance metrics outGrace delays health; warmup delaysmetricsLaunch hook holds instance inPending:Wait4✓Cooldown, warmup andhooksProtection: before selectionTermination policy: which instancegoesHook delays but never saves theinstanceOldestLaunchTemplate retires oldversions5✓Controlling scale-inFlapping: target tracking plus warmupDesired equals max: no headroomFailed launches: capacity, quota, badAMISuspended AlarmNotification ignoresalarms6✓Troubleshooting scalingECS: service scaling plus capacityproviderFargate needs only service autoscalingProvisioned concurrency removes coldstartsReserved concurrency guarantees andcaps7✓ECS and Lambda scalingCloudFront offloads the web tierCache key: only values that change theresponseOrigin Shield collapses originrequestsMemcached has no replication orfailover8✓Caching to scaleReplicas scale reads, shards scalewritesRising Evictions: add memory, notreplicasReclaimed means TTL expiryAlarm on EngineCPUUtilization9✓ElastiCache scalingMulti-AZ resize: one brief failoverStorage autoscaling only growsRead replicas: async, watch ReplicaLagReader endpoint reaches new AuroraReplicas10✓RDS and Aurora scalingOn-demand for spiky or new workloadsProvisioned auto scaling reacts inminutesThrottling with spare capacity: hotkeyDAX for microsecond reads, same API11✓DynamoDB capacityAuto scaling andelasticity
Mind map

Auto Scaling and Elasticity: EC2, Caching, and Database Scaling

Min blocks scale-in, max blocksscale-outLaunch templates are versioned forroll backAdd ELB health checks behind a loadbalancerGrace period longer than real startuptime1✓Group capacity and healthTarget tracking is the default, leastconfigStep scaling sizes the response to thebreachScheduled action should raise min, notdesiredPredictive: forecast only mode first2✓Five policy typesMetric must fall as capacity is addedALBRequestCountPerTarget for I/O-boundfleetsNever total RequestCountSQS: backlog per instance, target inmessages3✓Picking the trackedmetricDefault cooldown (300 s) is simplescaling onlyWarmup keeps new instance metrics outGrace delays health; warmup delaysmetricsLaunch hook holds instance inPending:Wait4✓Cooldown, warmup andhooksProtection: before selectionTermination policy: which instancegoesHook delays but never saves theinstanceOldestLaunchTemplate retires oldversions5✓Controlling scale-inFlapping: target tracking plus warmupDesired equals max: no headroomFailed launches: capacity, quota, badAMISuspended AlarmNotification ignoresalarms6✓Troubleshooting scalingECS: service scaling plus capacityproviderFargate needs only service autoscalingProvisioned concurrency removes coldstartsReserved concurrency guarantees andcaps7✓ECS and Lambda scalingCloudFront offloads the web tierCache key: only values that change theresponseOrigin Shield collapses originrequestsMemcached has no replication orfailover8✓Caching to scaleReplicas scale reads, shards scalewritesRising Evictions: add memory, notreplicasReclaimed means TTL expiryAlarm on EngineCPUUtilization9✓ElastiCache scalingMulti-AZ resize: one brief failoverStorage autoscaling only growsRead replicas: async, watch ReplicaLagReader endpoint reaches new AuroraReplicas10✓RDS and Aurora scalingOn-demand for spiky or new workloadsProvisioned auto scaling reacts inminutesThrottling with spare capacity: hotkeyDAX for microsecond reads, same API11✓DynamoDB capacityAuto scaling andelasticity

How the exam tests this

Task 2.1 questions hand you a demand pattern or a misbehaving fleet and ask for the best-fit control, often setting near-twins against each other: target tracking versus step versus predictive scaling, instance warmup versus the default cooldown, grace period versus target group threshold, scale-in protection versus a termination hook, AlarmNotification versus ScheduledActions, reserved versus provisioned concurrency. Expect arithmetic on target values (requests per target, backlog per instance) and metric reading: Evictions versus Reclaimed, EngineCPUUtilization versus CPUUtilization, ReplicaLag, throttle events. Database stems hinge on endpoints and modes: the reader endpoint for auto-scaled Aurora Replicas, a same-endpoint Multi-AZ resize versus a new-endpoint replica promotion, on-demand versus provisioned DynamoDB. Watch for answers that add availability (Multi-AZ, replicas) when the question asks for write capacity or memory, and read whether the goal is more capacity or more resilience before choosing.

Key takeaways

  1. "Keep a metric near a value" → target tracking, on a metric that falls as capacity is added: average CPU, ALBRequestCountPerTarget (not total RequestCount), or SQS backlog per instance.
  2. Backlog per instance target = acceptable wait ÷ processing time per message, a number of messages (120 s ÷ 4 s = 30).
  3. The default cooldown applies only to simple scaling; target tracking and step scaling use instance warmup, which keeps booting instances out of the aggregated metric.
  4. To pre-warm for a known peak, have the scheduled action raise min capacity (and lower it later); raising only desired is undone by target tracking.
  5. Predictive scaling needs recurring history; start in forecast only mode, and use a scheduling buffer for slow-booting instances.
  6. Scale-in protection keeps an instance from being selected; a termination hook only delays an instance already selected; OldestLaunchTemplate removes instances on an old template version first.
  7. Alarm in ALARM with no activities → check suspended processes (AlarmNotification); InsufficientInstanceCapacity → more Availability Zones and a mixed instances policy, not a quota increase.
  8. ECS on EC2 needs both service auto scaling (tasks) and an ASG capacity provider with managed scaling (instances); Lambda cold starts → provisioned concurrency, not reserved.
  9. CloudFront: keep the cache key to what changes the response; Origin Shield centralizes origin requests. ElastiCache: Evictions = memory pressure, Reclaimed = expired TTLs; replicas add reads, shards add writes and memory.
  10. Multi-AZ RDS resizes with a brief failover on the same endpoint; Aurora Replica auto scaling only helps clients on the reader endpoint; DynamoDB on-demand absorbs up to double the previous peak, and DAX adds microsecond reads without caching code.
0/11
Ready to start

Part 1: How an EC2 Auto Scaling group keeps capacity right

Min, max and desired capacity, versioned launch templates, mixed instances, ELB health checks and a grace period matching startup.

2 min read · 11 parts, about 17 min in allStart lesson

Frequently asked questions

What is the difference between target tracking and step scaling?

Target tracking holds a metric at a value you choose, such as average CPU at 50%, and AWS creates and manages the CloudWatch alarms and scales in both directions. Step scaling uses alarms you create plus step adjustments sized to how far the metric breached, and it can keep responding while a scaling activity is in progress. Use target tracking by default; use step scaling when you need different-sized responses at different severity levels.

Why does my Auto Scaling group keep launching and terminating instances repeatedly?

That is flapping. It usually comes from paired scale-out and scale-in policies with thresholds too close together, combined with booting instances dragging the average metric down so the scale-in policy fires. Fix it by replacing the pair with one target tracking policy, setting the group's default instance warmup to the time an instance takes to start serving, or widening the gap between the thresholds. Changing the default cooldown does not help, because it applies only to simple scaling policies.

What is the difference between scale-in protection and a termination lifecycle hook?

Scale-in protection removes an instance from selection when an Auto Scaling group scales in, so a busy instance is never chosen. A termination lifecycle hook acts after selection: it holds the chosen instance in Terminating:Wait for up to its heartbeat timeout (30 to 7,200 seconds, extendable with heartbeats to 48 hours or 100 times the timeout, whichever is smaller), and the instance still terminates afterwards. Use protection for long-running work and a hook for draining or cleanup.

Sign up free to mark lessons complete, bookmark topics and track your exam readiness.

Spotted a mistake in this lesson?