An Auto Scaling group maintains desired EC2 capacity. Scaling policies respond to demand, health checks identify instances to replace, and lifecycle hooks and instance refresh control initialization and configuration updates.
EC2 Auto Scaling basics
Amazon EC2 Auto Scaling adds and removes EC2 instances so capacity matches demand, which supports elasticity and availability.
How it works
- Create an Auto Scaling group with minimum, desired and maximum sizes.
- Scaling policies raise or lower the desired count as load changes.
- The group replaces instances to keep the count.
Exam cues
- If the question says match the number of EC2 instances to demand, think EC2 Auto Scaling.
Remember
- Group sizes: minimum, desired, maximum.
Trap: Auto Scaling changes how many instances run (horizontal scaling); it does not resize one instance.
Da documentação da AWS (8)
- Amazon EC2 Auto Scaling keeps the right number of EC2 instances for the load, in collections called Auto Scaling groups with a minimum, desired and maximum size; scaling policies change the count within those limits.
- An Auto Scaling group maintains desired capacity within its minimum and maximum size limits.
- An Auto Scaling group launches replacement instances after unexpected termination to maintain desired capacity.
- EC2 status checks and scheduled events are always part of Auto Scaling health evaluation.
- Auto Scaling ignores load balancer health results by default; enabling Elastic Load Balancing health checks makes it replace instances reported unhealthy by the load balancer.
- VPC Lattice health checks are optional and use the target group health result to identify unhealthy instances.
- Optional EBS health checks evaluate volume reachability and I/O status.
- Custom health checks can report application-specific health problems to Auto Scaling.
Groups, launch templates, and AZ balance
An Auto Scaling group maintains a chosen amount of EC2 capacity and replaces instances that terminate unexpectedly. A launch templateA versioned set of settings used to launch an EC2 instance. is its versioned recipe for new instances, including the machine imageA template containing the software configuration used to launch an instance., instance type and security groupsNetwork traffic rules that control incoming and outgoing connections for associated EC2 instances.. A machine image supplies the software to boot the instance; security groups are network traffic rules for its connections.
How it works
- Set minimum, desired and maximum capacity. The group attempts to maintain desired capacityThe amount of instance capacity an Auto Scaling group tries to maintain. within those limits.
- Select subnetsA network subdivision that resides entirely within one Availability Zone. in the Availability Zones to use. An Availability ZoneAn isolated location within an AWS Region. is an isolated location within a Region; a subnet belongs to one zone.
- Choose an Availability Zone distribution strategy. Balanced best effort is the default and can launch in another healthy zone after a failure. Balanced only keeps retrying the affected zone.
- With balanced best effort, if a zone becomes unavailable, the group can launch in other enabled zones. When it rebalances, it launches replacements before terminating existing instances. Capacity shortages can still prevent launches; additional instance types or zones provide more places to find capacity. A load balancer distributes application requests among the instances.
- During scale-inRemoving instance capacity from an Auto Scaling group., which means removing capacity, zone balance normally takes priority. Within the eligible zone, the default termination policyRules that prioritize eligible instances for removal from a group. removes outdated configurations first, then considers the next billing hour and breaks remaining ties randomly. Unhealthy instances bypass this policy.
- Put the AMI in the launch template; instance types can be supplied when the group is created.
- Updating the launch template affects new instances, not existing ones. Use instance refreshAn operation that replaces group instances using an updated instance configuration. to replace the fleet.
| Termination choice | Selection rule |
|---|---|
| Default | Launch configurations, other templates, then oldest current-template version |
| OldestInstance | Oldest instance |
| NewestInstance | Newest instance |
| AllocationStrategy | Keep capacity aligned with the configured allocation strategyThe configured approach for selecting capacity from instance types or Spot pools. |
| Custom Lambda | Return instance IDs ready to terminate based on application state |
Exam cues
- If the question says a zone fails under balanced best effort, think replacement capacity in other enabled zones, because the group attempts to maintain desired capacity.
- If preserving zone balance matters more than launching elsewhere, choose balanced only.
- If the question says a newer instance was removed under OldestInstance, think zone balance, because it takes priority over age.
- If the question says only idle workers should be selected for scale-in, think a Lambda custom termination policy, because it can use application state to return candidates.
- If the question says phase out instances from an earlier configuration during scale-in, think OldestLaunchTemplate or OldestLaunchConfiguration, because they terminate noncurrent configurations first.
Remember
- Minimum <= desired <= maximum capacity.
- Rebalancing launches before terminating.
- Default rebalancing headroom is 10% of maximum capacity or one instance, whichever is greater. An instance maintenance policy can set replacement thresholds.
- Launch template versions are immutable; changes make a new version.
- Auto Scaling registers instances with its attached load balancer.
Trap: A termination policy does not override zone balance or protect an unhealthy instance from replacement.
Clients send requests to the load balancer.
The load balancer distributes requests to instances in one zone.
Instances in another zone also serve requests.
Detalhes das caixas (1)
- Load balancer
Distributes application requests among group instances.
Da documentação da AWS (28)
- A launch template is a versioned set of instance launch settings, including the machine image, instance type and security groups.
- An Availability Zone is an isolated location in a Region; each subnet belongs to one Availability Zone.
- Balanced best effort and balanced only aim for an even instance distribution across enabled Availability Zones.
- With balanced best effort, if an Availability Zone becomes unavailable, Auto Scaling can launch instances in other enabled zones and rebalance when the zone recovers.
- Availability Zone rebalancing launches replacement instances before terminating existing instances.
- By default, Availability Zone rebalancing can temporarily exceed maximum capacity by 10 percent or one instance, whichever is greater; an instance maintenance policy can control replacement thresholds.
- A load balancer distributes application traffic among instances in an Auto Scaling group.
- For scale-in under balanced distribution, Auto Scaling prioritizes Availability Zone balance before applying termination policies to eligible instances.
- For a launch-template group, the default termination policy prioritizes launch configurations, then other launch templates, then the oldest version of the current template.
- After configuration criteria, the default termination policy chooses instances closest to the next billing hour and breaks remaining ties randomly.
- OldestInstance prioritizes the oldest eligible instance for termination.
- NewestInstance prioritizes the newest eligible instance for termination.
- AllocationStrategy prioritizes terminations that align remaining capacity with the configured allocation strategy.
- A Lambda custom termination policy returns instance IDs ready for termination; its input includes capacity to terminate and suggested instances.
- Instances marked unhealthy bypass termination policy evaluation.
- An Amazon Machine Image provides the software needed to set up and boot an EC2 instance.
- A security group controls incoming and outgoing network traffic for associated EC2 instances.
- An EC2 instance type or Availability Zone capacity shortage can prevent Auto Scaling launches; using more instance types or zones can help.
- Balanced best effort is the default and tries another healthy zone after a launch failure; balanced only keeps retrying the affected zone to preserve balance.
- A launch template for an Auto Scaling group must specify an AMI; instance types can be supplied when creating the group. Multiple instance types and mixed purchase options require a launch template.
- A new launch template applies to new instances; existing instances keep their original configuration until replaced, for example by instance refresh.
- OldestLaunchConfiguration terminates instances on a noncurrent launch configuration first. OldestLaunchTemplate terminates instances on a noncurrent launch template first, then those on the oldest version of the current template.
- EC2 Auto Scaling has no additional fee beyond the EC2 instances, CloudWatch and other resources it uses.
- In a group with mixed instance purchase options, scale-in first picks whether to terminate Spot or On-Demand capacity to match the allocation, then applies AZ balance and the termination policy.
- An Auto Scaling group can launch from the default, the latest or a specific version of its launch template when it scales out.
- EC2 does not publish memory metrics; the CloudWatch agent collects memory metrics such as mem_used_percent from inside the instance.
- A launch template version can't be modified; changes create a new version, and a version can set the AMI, instance type, subnet, key pair and security groups for instances launched directly or by Auto Scaling.
- When an Auto Scaling group has an attached load balancer, its instances are registered with the load balancer automatically.
Scaling policy selection
Scaling policies change the desired capacityThe amount of instance capacity an Auto Scaling group tries to maintain. of an EC2 Auto Scaling group as demand changes. Scale-outAdding instance capacity to an Auto Scaling group. adds capacity; scale-inRemoving instance capacity from an Auto Scaling group. removes it. Choose a policy based on whether the trigger is current utilization, a known time or a recurring demand pattern.
How it works
- For current demand, choose a metricA measured value, such as average CPU utilization, that a scaling policy can monitor. target or alarm thresholds. Target trackingA scaling policy that adjusts capacity to keep a utilization metric near a target. manages its alarms; step and simple scaling use alarms you manage.
- For a known time, create a scheduled action that changes minimum, maximum or desired capacity.
- For recurring patterns, let predictive scaling analyze history in forecast-only mode. Review the forecast before enabling forecast and scale.
- Combine predictive scaling with a dynamic policy for unexpected demand and scale-in. Predictive scaling does not remove capacity.
- A CloudWatch alarm using PromQL, the Prometheus query language, can invoke a step or simple scaling policy. PromQL alarms do not support target tracking policies.
| Choice | Trigger and behavior |
|---|---|
| Target tracking | Adjust capacity toward a metric target |
| Step scaling | Choose an adjustment by alarm breach size |
| Simple scaling | Make one adjustment, then wait for cooldownA pause after a scaling activity before another simple scaling activity can begin. |
| Scheduled scaling | Change capacity at specified times |
| Predictive scaling | Add capacity ahead of forecast demand |
Exam cues
- If the question says keep average CPU near a target, think target tracking, because it adjusts capacity and manages the alarms.
- If the question says add progressively more instances for larger breaches, think step scaling, because each breach range has an adjustment.
- If the question says open at a known time, think scheduled scaling, because its trigger is a schedule.
- If the question says recurring demand should be learned from history, think predictive scaling plus dynamic scaling, because prediction adds capacity and dynamic scaling can remove it.
Remember
- Simple scaling cooldown defaults to 300 seconds. Target tracking and step scaling scale-out, scheduled actions and unhealthy replacement do not wait for it.
- AWS recommends target tracking or step scaling over simple scaling.
- Forecast-only is the initial mode.
- Since November 2026, PromQL alarms support simple and step scaling, not target tracking.
- Default cooldown: 300 seconds; a simple scaling policy can set its own.
Trap: Enabling predictive scaling does not immediately enable scaling, and forecast-and-scale mode does not scale in.
Da documentação da AWS (13)
- Target tracking adjusts group capacity toward a metric target and manages the associated CloudWatch alarms.
- Step scaling uses operator-managed CloudWatch alarms and different capacity adjustments based on the size of the alarm breach.
- Simple scaling performs one adjustment and waits for a cooldown before further simple scaling activities.
- The default cooldown is 300 seconds unless configured otherwise.
- Target tracking and step scaling scale-out, scheduled actions and unhealthy instance replacement do not wait for simple scaling cooldown.
- AWS recommends target tracking or step scaling instead of simple scaling and cooldowns.
- Scheduled scaling changes minimum, maximum or desired capacity at specified times and supports recurring schedules.
- Predictive scaling forecasts recurring demand from historical metric data and starts in forecast-only mode.
- Forecast-and-scale mode adds capacity for predicted demand but does not scale in; dynamic policies can remove excess capacity and handle unexpected demand.
- Since November 2026, CloudWatch PromQL alarms can invoke EC2 Auto Scaling step and simple scaling policies, but not target tracking policies.
- A scheduled action sets a new desired capacity at a specific time, optionally with new minimum and maximum values, so the group scales out before a predictable peak.
- Auto Scaling processes such as Launch, Terminate, HealthCheck, ReplaceUnhealthy, AddToLoadBalancer and AZRebalance can be suspended and resumed, for example to troubleshoot without scaling policies or health replacements interfering.
- An Auto Scaling group default cooldown is 300 seconds; simple scaling policies wait for it unless a policy sets its own cooldown.
Target tracking metrics and warmup
Target trackingA scaling policy that adjusts capacity to keep a utilization metric near a target. adjusts EC2 Auto Scaling capacity toward a chosen utilization value. Its metricA measured value, such as average CPU utilization, that a scaling policy can monitor. must describe how busy each instance is, so adding capacity reduces the measured load per instance.
How it works
- Select a predefined metric or a custom utilization metric. For queue workers, use backlog per instanceThe queued message count divided by the number of instances processing the queue., meaning queued messages divided by the worker count.
- Set a target. Auto Scaling creates and manages the CloudWatch alarms; leave those alarms under its control.
- During scale-outAdding instance capacity to an Auto Scaling group., exclude new instances from aggregated instance metrics until warmupThe initialization period during which a new instance is excluded from aggregated instance metrics. ends. Later scale-out still counts those instances as pending capacity.
- Block policy-driven scale-inRemoving instance capacity from an Auto Scaling group. until the new instances finish warming up. With multiple target tracking policies, any policy can request scale-out, but every policy with scale-in enabled must agree to scale in.
| Metric | Meaning |
|---|---|
| ASGAverageCPUUtilization | Average group CPU utilization |
| ASGAverageNetworkIn | Average incoming bytes |
| ASGAverageNetworkOut | Average outgoing bytes |
| ALBRequestCountPerTarget | Average requests per target; requires ResourceLabel for the load balancer target group |
Exam cues
- If the question says scale queue workers as the fleet changes, think messages per instance, because raw queue length does not measure each worker’s utilization.
- If the question says startup measurements cause excess scaling, think instance warmup, because new instance metrics stay out of the aggregate while pending capacity is still counted.
- If the question says a CPU policy wants scale-in while a request policy wants scale-out, think scale-out, because availability takes priority.
- If the question says missing metric data, think INSUFFICIENT_DATA, because target tracking waits for new data before scaling.
Remember
- Basic EC2 monitoring publishes every 5 minutes; detailed monitoring publishes every minute.
- Total RequestCount, Latency and raw SQS ApproximateNumberOfMessagesVisible are unsuitable target tracking metrics.
Trap: A load balancer’s total requests are not requests per target. Use ALBRequestCountPerTarget with the target group’s ResourceLabel.
Da documentação da AWS (14)
- A target tracking metric must represent utilization and change proportionally as group capacity changes.
- ASGAverageCPUUtilization measures average group CPU utilization.
- ASGAverageNetworkIn measures average bytes received on instance network interfaces.
- ASGAverageNetworkOut measures average bytes sent on instance network interfaces.
- ALBRequestCountPerTarget measures average requests per target and requires ResourceLabel identifying the load balancer target group.
- Total load balancer RequestCount and load balancer Latency are unsuitable for target tracking because they do not change proportionally with group capacity.
- Raw SQS ApproximateNumberOfMessagesVisible is unsuitable for target tracking; a custom messages-per-instance metric can work.
- With multiple target tracking policies, any policy can trigger scale-out; all policies with scale-in enabled must agree before scale-in.
- New instances are excluded from aggregated instance metrics until warmup ends.
- Further target tracking scale-out accounts for instances still warming up as part of desired capacity.
- Policy-driven scale-in is blocked during scale-out until the new instances finish warming up.
- EC2 metrics default to five-minute intervals; detailed monitoring provides one-minute intervals, which AWS recommends for target tracking.
- When missing metric data causes INSUFFICIENT_DATA, target tracking cannot scale until new data arrives.
- Auto Scaling creates and manages target tracking CloudWatch alarms; operators should not create, edit or delete those alarms.
Health checks and grace periods
Health checks let EC2 Auto Scaling identify instances to replace. EC2 checks cover instance and host problems; optional traffic-service checks let the group also react when an application cannot serve requests.
How it works
- Auto Scaling evaluates EC2 status checks and scheduled events. These checks are always included.
- Enable additional checks that match the application. By default the group ignores load balancer health results, even when the load balancer reports an unhealthy target.
- After a new instance reaches InServiceThe Auto Scaling state of an instance that has entered service in the group., meaning it has entered the serving state, the grace periodThe initial period in service during which Auto Scaling delays replacement for health failures. delays replacement for health failures while initialization finishes. A launch hook completes before this period starts.
- Load balancer checks continue independently. If an instance leaves the EC2 running state, Auto Scaling replaces it immediately, including during grace.
- For diagnosis, use StandbyAn Auto Scaling instance state that pauses Auto Scaling health checks until the instance returns to service. to suspend Auto Scaling health checks for that instance, or suspend the group’s HealthCheck and ReplaceUnhealthy processes.
| Signal | Configuration |
|---|---|
| EC2 status and scheduled events | Always included |
| Elastic Load Balancing | Opt in to use target health |
| VPC Lattice | Opt in to use target group health |
| EBS | Opt in to check volume reachability and I/O |
| Custom | Report application-specific problems |
Exam cues
- If the question says an ALB detects an unhealthy target but the group keeps it, think enable ELB health checks, because the group ignores them by default.
- If the question says a slow application is replaced during startup, think an appropriate grace period or launch hook, because initialization must finish before health failure triggers replacement.
- If the question says inspect a failing instance without replacement, think Standby, because Auto Scaling does not health-check it until it returns to service.
Remember
- Grace period defaults: console 300 seconds; CLI and SDK 0 seconds.
- Impaired EC2 checks receive a short opportunity to recover; insufficient-data alone does not mark an instance unhealthy.
- Leaving running state causes immediate replacement.
Trap: Grace is not a pause in load balancer checks and does not protect a stopped instance.
Da documentação da AWS (12)
- Auto Scaling ignores load balancer health results by default; enabling Elastic Load Balancing health checks makes it replace instances reported unhealthy by the load balancer.
- Auto Scaling waits a few minutes before marking an instance unhealthy after an impaired EC2 status check.
- An EC2 status check result of insufficient-data alone does not mark an instance unhealthy.
- An instance that leaves the EC2 running state is marked unhealthy and replaced immediately, even during the grace period.
- The health check grace period delays unhealthy replacement for a newly InService instance while load balancer health checks continue independently.
- A new Auto Scaling group created in the console defaults to a health check grace period of 300 seconds.
- A new Auto Scaling group created through the CLI or SDK defaults to a health check grace period of 0 seconds.
- With a launch lifecycle hook, the grace period starts after the instance reaches InService.
- Auto Scaling does not perform health checks on instances in Standby until they return to service.
- Suspending HealthCheck and ReplaceUnhealthy can prevent automatic health-based replacement during troubleshooting.
- When an EC2 status check becomes impaired, Auto Scaling waits a few minutes for AWS to fix the issue before marking the instance unhealthy, and it never marks an instance unhealthy for insufficient-data.
- By default, Auto Scaling replaces an unhealthy instance by terminating it first and then launching a new one in a separate scaling activity; an instance maintenance policy can make it launch the replacement first.
Lifecycle hooks
A lifecycle hookA pause during instance launch or termination that allows a custom action to finish. pauses an EC2 Auto Scaling instance while custom work finishes. It lets initialization complete before load balancer registration and gives cleanup automation time before termination. BootstrappingInstalling and configuring software during an instance launch. means installing and configuring the application during startup.
How it works
- A launch hook holds the instance in Pending:Wait. Auto Scaling emits a lifecycle event to EventBridge.
- A script or event-triggered action finishes setup. EventBridge can route notifications to Lambda; a Run Command target can install software on a Systems Manager managed nodeAn instance managed by Systems Manager on which tools such as Run Command can act., meaning an instance managed by Systems Manager.
- Complete the action with CONTINUE to allow registration and service entry. Send heartbeatsA signal that extends a lifecycle action wait within its overall timeout. if work needs more time, within the global timeout.
- A termination hook holds an instance in Terminating:Wait while automation collects logs. Completing the action permits termination.
Exam cues
- If the question says finish setup before receiving traffic, think launch hook, because registration waits for the action to complete.
- If the question says collect logs before removal, think termination hook with EventBridge automation, because the instance pauses in Terminating:Wait.
- If the question says initialize first and gradually increase traffic afterward, think launch hook plus ALB slow startAn ALB target group setting that gradually increases requests sent to a new healthy target., because they control different parts of startup.
Remember
- A hook defaults to ABANDON when it times out or fails unexpectedly, unless configured otherwise.
- Slow start requires a compatible ALB routing algorithm; least outstanding requests and weighted random do not support it.
Trap: A termination hook is best effort by default. It cannot keep a Spot instance alive when capacity is interrupted.
A launch hook pauses the instance and emits an event.
An EventBridge rule invokes the setup action.
After setup completes with CONTINUE, the instance can register with the load balancer.
Da documentação da AWS (12)
- A lifecycle hook pauses instance launch or termination to allow a custom action before the next state.
- A launch lifecycle hook holds an instance in Pending:Wait before it registers with the load balancer.
- Completing a launch hook lets Auto Scaling register the initialized instance with its load balancer.
- A termination hook pauses an instance in Terminating:Wait so automation can collect logs before termination.
- CompleteLifecycleAction completes a lifecycle action and RecordLifecycleActionHeartbeat extends its wait within the overall timeout.
- When a lifecycle hook times out or has an unexpected failure, its default result is ABANDON unless configured otherwise.
- CONTINUE on a launch lifecycle hook permits the instance to enter service.
- ABANDON on a launch lifecycle hook permits termination and replacement of the instance.
- Termination lifecycle hooks are best effort by default, and a hook cannot prevent a Spot capacity interruption.
- EventBridge rules can filter lifecycle notifications and route them to Lambda, SNS or SQS.
- An EventBridge rule can target Systems Manager Run Command to install software on a newly created Auto Scaling managed node or collect logs before termination.
- ALB slow start gradually increases traffic to a new healthy target; it is incompatible with least outstanding requests and weighted random routing.
Warm pools
A warm poolA set of initialized instances kept alongside an Auto Scaling group for faster scale-out. keeps initialized EC2 instances ready beside an Auto Scaling group. It reduces the time needed to add capacity when a fresh instance takes a long time to prepare.
How it works
- Auto Scaling prepares pool instances. Use a launch lifecycle hookA pause during instance launch or termination that allows a custom action to finish. to finish initialization before they stop or hibernate.
- Keep prepared instances in a supported state. HibernationSaving instance memory to the EBS root volume before stopping so that memory can be restored on restart. saves memory contents to the EBS root volume so they can be restored when the instance starts.
- On scale-outAdding instance capacity to an Auto Scaling group., take an instance from the pool. A launch hook can pause it again before service entry; it counts toward desired capacityThe amount of instance capacity an Auto Scaling group tries to maintain. when it leaves the pool.
- On scale-inRemoving instance capacity from an Auto Scaling group., instances terminate by default. Enable an instance reuse policyA setting that returns scaled-in instances to the warm pool for later use. to return them to the pool. An instance refreshAn operation that replaces group instances using an updated instance configuration. replaces serving instances first, then pool instances.
| Pool state | Resource cost or requirement |
|---|---|
| Stopped | EBS root volume; volume and attached Elastic IP charges remain |
| Hibernated | Supported hibernation configuration; root volume also stores memory contents |
| Running | Instance charges continue |
Exam cues
- If the question says long first boot delays scale-out, think warm pool, because preparation happens before demand arrives.
- If the question says reuse configured instances after scale-in, think instance reuse policy, because default scale-in terminates them.
- If the question says setup is interrupted when pool instances stop, think launch lifecycle hook, because stopping does not wait for setup by itself.
Remember
- Mixed groups with warm pools cannot use instance weighting or Spot.
- Stopped and Hibernated require EBS root volumes.
Trap: A stopped warm-pool instance still has storage and potentially attached Elastic IP charges. A new launch templateA versioned set of settings used to launch an EC2 instance. does not update existing pool instances until they are replaced.
Initialize the instance before storing it in the pool.
Draw prepared capacity from the pool on scale-out.
Finish the launch hook before service entry.
Da documentação da AWS (12)
- A warm pool keeps pre-initialized EC2 instances alongside an Auto Scaling group to reduce scale-out startup latency.
- Instances drawn from the warm pool count toward group desired capacity when they leave the pool.
- Warm-pool instances can be Stopped, Hibernated or Running.
- Stopped warm-pool instances incur charges for volumes and attached Elastic IP addresses.
- Hibernated warm-pool instances incur volume and attached Elastic IP charges, including root-volume space for saved memory.
- Running warm-pool instances incur instance charges.
- A Stopped or Hibernated warm-pool instance requires an EBS root volume.
- A Hibernated warm-pool instance must satisfy the EC2 hibernation requirements.
- Warm pools do not support instance weighting or Spot Instances in mixed instance groups.
- Scale-in terminates instances by default; an instance reuse policy can return them to the warm pool.
- Launch hooks delay stopping or hibernation until initialization finishes and can pause instances again before they enter service from the pool.
- Instance refresh updates InService instances first, then warm-pool instances; changing a launch template alone does not replace existing pool instances.
Flashcards
Nada para revisar aqui agora. Escolha outros tópicos ou outro filtro.
·
Todos os 54 flashcards em lista
Traffic to a web app doubles every evening. How can the number of EC2 instances follow the load automatically?
Amazon EC2 Auto Scaling, with an Auto Scaling group and a scaling policy.
What three sizes does an EC2 Auto Scaling group define?
Minimum, desired and maximum number of instances.
An EC2 Auto Scaling group must keep a fixed fleet size without demand-based scaling. Which setting defines that size?
Desired capacity. The group maintains it and replaces unexpectedly terminated instances.
Which health signals can an EC2 Auto Scaling group evaluate?
EC2 status checks and scheduled events are always included. ELB, VPC Lattice and EBS checks are optional; custom checks can report other health problems.
An Availability Zone used by an EC2 Auto Scaling group with balanced best effort becomes unavailable. How does recovery work, and what can block it?
It can launch replacements in other enabled zones. When balance is restored, rebalancing launches instances before terminating others. Capacity shortages can still prevent launches; using more instance types or zones can help.
An EC2 Auto Scaling group uses OldestInstance, but removes a newer instance in a crowded zone. Why?
Availability Zone balance takes priority over the termination policy. The policy is applied to eligible candidates after choosing the zone.
Which configuration order does the EC2 Auto Scaling default termination policy prefer in a launch-template group?
Launch configurations, other launch templates, then the oldest version of the current template. Billing-hour proximity and random selection resolve remaining ties.
An EC2 Auto Scaling application must select idle workers for scale-in using application state. Which feature can choose candidates?
A Lambda custom termination policy. It evaluates the supplied candidates and returns the IDs ready for termination.
Which EC2 Auto Scaling termination policies prioritize the oldest instance, newest instance or configured allocation strategy?
OldestInstance, NewestInstance and AllocationStrategy, respectively.
An EC2 Auto Scaling group must keep Availability Zones balanced even if launches fail in one zone. Which distribution strategy should it use?
Balanced only. It retries the affected zone; the default balanced best effort can launch in another healthy zone.
An EC2 Auto Scaling group needs Spot and On-Demand instances across multiple instance types. What must its launch template include?
Use a launch template with an AMI. Instance types can be specified when creating the group.
An EC2 Auto Scaling group switches to a new launch template, but existing instances still use the old AMI. How can the fleet be updated?
Start an instance refresh. The updated template applies to new instances, not existing ones.
An Auto Scaling group moved to a new launch template, and scale-in must remove instances from the old configuration first. Which termination policies target that?
OldestLaunchTemplate, or OldestLaunchConfiguration for groups on launch configurations. Zone balance is still applied before either policy.
An EC2 Auto Scaling group spans multiple Availability Zones. How can it respond when one zone becomes unavailable?
With balanced best effort, it can launch instances in other enabled zones and rebalance when the zone recovers.
After a scale-in, an Auto Scaling group with Spot and On-Demand instances is briefly uneven across AZs. Why?
Scale-in first keeps the Spot and On-Demand allocation, then balances AZs and applies the termination policy.
A team wants new instances in an Auto Scaling group to use each new launch template version automatically. Which version setting fits?
Latest. The group can use the default, the latest or a specific version; a pinned or default version does not follow new versions.
An Auto Scaling group must scale on memory utilization, but no memory metric appears in CloudWatch. What is missing?
The CloudWatch agent on the instances. EC2 does not publish memory metrics; the agent sends them as custom metrics a scaling policy can use.
A team must change the AMI in an EC2 launch template used by an Auto Scaling group. Can it edit the existing version?
No. Launch template versions are immutable; create a new version and point the group at it.
An Auto Scaling group with an attached Application Load Balancer launches new instances. Must an operator register them with the target group?
No. Auto Scaling registers its instances with the attached load balancer automatically.
Which EC2 Auto Scaling policy keeps average CPU near a target without manually maintaining its alarms?
Target tracking. Auto Scaling manages the CloudWatch alarms for the chosen metric target.
How do EC2 Auto Scaling target tracking, step scaling and simple scaling differ?
Target tracking maintains a metric target. Step scaling chooses an adjustment by alarm breach size. Simple scaling makes one adjustment and waits for cooldown.
An EC2 Auto Scaling application has a known opening time and recurring daily peaks. Which proactive scaling choices apply?
Scheduled scaling changes capacity at known times. Predictive scaling learns recurring demand; review forecast-only results before enabling forecast and scale.
An EC2 Auto Scaling simple scaling policy pauses after a capacity change. What is the default cooldown?
300 seconds, unless changed for the group or policy. AWS recommends target tracking or step scaling for better scaling performance.
An EC2 Auto Scaling predictive policy adds capacity for a morning peak but leaves excess instances afterward. What is missing?
A dynamic scaling policy for scale-in. Predictive scaling only adds capacity in forecast-and-scale mode.
An EC2 Auto Scaling alarm must add more instances for larger threshold breaches. Which policy fits?
Step scaling. Define adjustments for different breach sizes and manage the CloudWatch alarm that invokes the policy.
A team wants a CloudWatch PromQL alarm to scale an EC2 Auto Scaling group by different amounts for different threshold breaches. Which policy supports this?
Step scaling. Since November 2026, PromQL alarms can trigger step and simple scaling, but not target tracking.
A workload peaks at a known hour on the last day of every month. How should an Auto Scaling group be ready with 10 instances before the peak?
Create a scheduled action for that time that sets the desired capacity to 10. Target tracking and simple scaling only react after the load arrives.
Engineers must troubleshoot an instance in an Auto Scaling group without the group terminating or replacing it. What should they do?
Suspend Auto Scaling processes such as Terminate, ReplaceUnhealthy or HealthCheck, then resume them after the investigation.
An EC2 Auto Scaling group uses a simple scaling policy with no cooldown of its own. How long does it wait after a scaling activity before the next simple scaling action?
The group default cooldown, 300 seconds unless changed.
Which EC2 Auto Scaling target tracking metrics work for web servers or queue workers?
Use average CPU, average network traffic, ALBRequestCountPerTarget or a custom messages-per-instance metric. The metric must reflect per-instance utilization.
Which predefined metrics does EC2 Auto Scaling target tracking support?
ASGAverageCPUUtilization, ASGAverageNetworkIn, ASGAverageNetworkOut and ALBRequestCountPerTarget. The ALB metric requires ResourceLabel for the load balancer target group.
Why are total load balancer RequestCount and Latency unsuitable for EC2 Auto Scaling target tracking?
They do not change proportionally as group capacity changes. Use a utilization metric such as average CPU or requests per target.
Two EC2 Auto Scaling target tracking policies disagree about scaling direction. What happens?
Any policy can trigger scale-out. Scale-in requires agreement from all policies with scale-in enabled.
An EC2 Auto Scaling application starts slowly and its new instances distort utilization measurements. Which setting helps?
Instance warmup. New instances stay out of aggregated metrics until warmup ends, while later scale-out accounts for their pending capacity.
An EC2 Auto Scaling group processes an SQS queue whose worker count changes. Which target tracking metric fits?
Messages per instance, also called backlog per instance. Raw ApproximateNumberOfMessagesVisible does not reflect utilization per worker.
An EC2 Auto Scaling target tracking alarm enters INSUFFICIENT_DATA. Should missing data be treated as permission to scale in?
No. Target tracking cannot scale until new metric data arrives.
An EC2 Auto Scaling group reacts slowly to CPU changes because it uses basic monitoring. What improves metric frequency?
Enable EC2 detailed monitoring to publish one-minute metrics instead of the default five-minute interval.
An ALB marks an EC2 Auto Scaling instance unhealthy, but the group keeps it. What should be enabled?
Elastic Load Balancing health checks on the Auto Scaling group. By default the group ignores the load balancer health result.
What does the EC2 Auto Scaling health check grace period delay after a launch hook?
Unhealthy replacement after the instance reaches InService. It does not pause load balancer checks, and leaving running state still causes immediate replacement.
An engineer needs to debug an EC2 Auto Scaling instance without health checks replacing it. Which options apply?
Put the instance in Standby, or suspend the group HealthCheck and ReplaceUnhealthy processes. Standby instances receive no Auto Scaling health checks until returned to service.
An EC2 Auto Scaling group was created with the CLI and has no grace period configured. What is its default, and how does the console differ?
CLI and SDK default to 0 seconds. The console defaults to 300 seconds.
An engineer stops a new EC2 Auto Scaling instance during its health check grace period. Will the grace period prevent replacement?
No. Leaving the EC2 running state causes immediate unhealthy marking and replacement, even within the grace period.
An instance status check just turned impaired, but Auto Scaling has not replaced the instance yet. Is something wrong?
Not necessarily. Auto Scaling waits a few minutes for AWS to fix an impaired status before it marks the instance unhealthy. A health check grace period that has not expired also delays replacement.
In what order does Auto Scaling replace an unhealthy instance by default, and how does that differ from AZ rebalancing?
It terminates the unhealthy instance first, then launches a replacement. AZ rebalancing does the opposite: it launches new instances before terminating old ones.
An EC2 Auto Scaling instance must finish installing software before load balancer registration. What should the group use?
A launch lifecycle hook. Hold the instance in Pending:Wait, finish setup, then complete the lifecycle action with CONTINUE.
An EC2 Auto Scaling instance must send logs before termination. Which automation fits?
Use a termination lifecycle hook with EventBridge automation, such as Lambda, while the instance waits in Terminating:Wait. Complete the action afterward; the hook cannot prevent a Spot interruption.
An EC2 Auto Scaling application behind an ALB must initialize before registration and receive requests gradually afterward. Which controls fit?
A launch lifecycle hook for setup, then ALB slow start for a gradual traffic increase after the target is healthy.
A launch lifecycle hook times out before the instance's setup finishes, and no default result was configured. What happens to the instance?
The hook falls back to ABANDON, so Auto Scaling terminates the instance and launches a replacement.
An EC2 Auto Scaling fleet must install software on new managed instances after an event. Which event-driven integration fits?
An EventBridge rule targeting Systems Manager Run Command. Use a launch lifecycle hook when setup must finish before load balancer registration.
When should an EC2 Auto Scaling group use a warm pool, and which states are available?
Use it when long initialization makes scale-out too slow. Keep pre-initialized instances Stopped, Hibernated or Running; hooks can hold them until setup finishes.
Which restrictions apply to stopped EC2 Auto Scaling warm pools and mixed instance groups?
Stopped or hibernated instances need an EBS root volume. Mixed groups cannot use Spot or instance weighting with warm pools. Hibernation needs a supported configuration.
An EC2 Auto Scaling team wants initialized instances returned to its warm pool on scale-in. What must it configure?
An instance reuse policy. Default scale-in terminates the instances.
An EC2 Auto Scaling warm pool stops instances before their user data setup finishes. What should prevent this?
A launch lifecycle hook. It delays stopping or hibernation until initialization completes and can pause promotion into service again.
An EC2 Auto Scaling application scales out slowly because new instances take a long time to initialize. What can reduce the delay?
Use a warm pool of pre-initialized instances so the group can add prepared capacity more quickly.