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.
From the AWS docs (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.
Box details (1)
- Load balancer
Distributes application requests among group instances.
From the AWS docs (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.
From the AWS docs (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.
From the AWS docs (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.
From the AWS docs (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.
From the AWS docs (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.
From the AWS docs (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.
Instance refresh
Instance refreshAn operation that replaces group instances using an updated instance configuration. replaces EC2 Auto Scaling instances with an updated configuration. It rolls a new machine imageA template containing the software configuration used to launch an instance. or instance setup through the fleet; updating a launch templateA versioned set of settings used to launch an EC2 instance. alone changes future launches.
How it works
- Prepare the launch template and desired configurationThe launch settings that an instance refresh should deploy to the group., meaning the settings the refresh should deploy.
- Set the healthy capacity budget. Minimum healthy percentage is the floor for capacity that stays healthy and ready; maximum healthy percentage controls the allowed increase during replacement.
- Replace instances, wait for health checks and instance warmupThe initialization period during which a new instance is excluded from aggregated instance metrics., then continue. Warmup is the stabilization period before the refresh treats a new instance as initialized.
- Enable skip matching to keep instances already using the desired launch template and instance types. User dataA startup script supplied in instance launch settings to configure software when an instance boots. is the startup script supplied with the launch settings. If an unchanged script downloads updated code, disable skip matching so every instance is replaced.
- Scale-outAdding instance capacity to an Auto Scaling group. during the operation uses the desired configuration. After success, Auto Scaling saves that configuration to the group.
Exam cues
- If the question says a new image exists but serving instances remain unchanged, think instance refresh, because a launch template change does not replace them.
- If the question says launch before removing serving capacity, think minimum and maximum healthy percentages of 100, because that configuration replaces one instance at a time by launching first.
- If the question says current instances are being needlessly replaced, think skip matching, because it compares their configuration with the desired settings.
Remember
- Without an instance maintenance policy: minimum healthy 90%, maximum healthy 100%.
- Minimum healthy 0% permits replacing all instances at once.
- Refresh warmup uses default instance warmup, then health check grace periodThe initial period in service during which Auto Scaling delays replacement for health failures. if unset.
- Skip matching: console on; CLI and SDK off.
- Alarms, auto rollbackReplacing instances deployed during a refresh with instances matching the previous saved group configuration. and checkpointsA configured percentage of replaced instances at which an instance refresh pauses. default off; bake timeThe final observation wait before an instance refresh is considered complete. defaults to zero.
- Active replacement limit: 14 days.
Trap: A new template version does not update running instances. Also, the refresh warmup fallback is the health check grace period.
Apply the desired configuration to a replacement.
Wait for its health checks and warmup.
Proceed with further replacements within the healthy capacity budget.
From the AWS docs (20)
- An instance refresh replaces group instances using an updated launch template or instance configuration.
- Updating the launch template used by a group affects new launches but does not update existing instances.
- Without an instance maintenance policy, instance refresh defaults to a minimum healthy percentage of 90 percent.
- Without an instance maintenance policy, instance refresh defaults to a maximum healthy percentage of 100 percent.
- Minimum healthy percentage defines how much desired capacity must remain healthy and ready during replacement.
- Maximum healthy percentage defines the capacity increase allowed during instance refresh replacement.
- Setting both minimum and maximum healthy percentage to 100 makes instance refresh replace instances one at a time by launching before terminating.
- A minimum healthy percentage of 0 allows all instances to be replaced at once.
- After replacement instances pass health checks, refresh waits for instance warmup before proceeding to further replacements.
- Refresh warmup defaults to group default instance warmup if configured, otherwise the health check grace period.
- Scale-out during instance refresh launches instances with the refresh desired configuration.
- A successful instance refresh saves the desired configuration to the Auto Scaling group.
- Skip matching avoids replacing instances that already match the desired launch template and instance types.
- Skip matching defaults to enabled in the console and disabled in the CLI or SDK.
- Instance refresh CloudWatch alarm specifications are disabled by default.
- Instance refresh auto rollback is disabled by default.
- Instance refresh checkpoints are disabled by default.
- Instance refresh bake time defaults to zero.
- An instance refresh can actively replace instances for at most 14 days.
- Skip matching cannot detect updated code fetched by an unchanged user data script; disable it when all instances must rerun that setup.
Launch failure troubleshooting
EC2 Auto Scaling launch troubleshooting starts with the failed scaling activity, which records why the group could not add an instance. Separate an invalid launch configuration from exhausted capacity or missing permissions before changing scaling policies.
How it works
- Open the group’s
Activitytab or usedescribe-scaling-activities. ReadStatusCodeandStatusMessagefor the failed launch. - Match the error to the resource or permission it names. A launch templateA versioned set of settings used to launch an EC2 instance. is a versioned instance configuration; check the version actually selected by the group.
- For a generic template error, read the more specific message and test the selected version with
run-instances --dry-run. A dry runA request check that does not perform the requested EC2 action. checks the request without launching an instance.DryRunOperationmeans the permission check succeeded. - Correct the cause, update the group’s launch settings when required, and inspect subsequent activities. If launches remain stopped, check for an administratively suspended process. Template diagnosis · Suspensions
| Evidence | Meaning | Response |
|---|---|---|
| Insufficient instance capacity | Requested capacity is unavailable | Retry or broaden suitable instance types and enabled AZs |
| EC2 quota reached | Account usage limit is exhausted | Reduce usage or request an increase |
InsufficientFreeAddressesInSubnet |
SubnetA network subdivision that resides entirely within one Availability Zone. address pool is exhausted | Check free addresses in the selected subnet |
| Missing or inaccessible AMIA template containing the software configuration used to launch an instance. | The machine image, the software used to boot, cannot be used | Check existence, state, sharing, and processor architectureThe processor instruction family that an instance type and its AMI must both support. |
| Deleted security groupNetwork traffic rules that control incoming and outgoing connections for associated EC2 instances. or key pair | Launch settings refer to a missing resource | Correct the settings used by the group |
| Launch-template authorization failure | Caller lacks required launch or role-passing access | Check ec2:RunInstances, launch-tag ec2:CreateTags, and profile-related iam:PassRole |
Encrypted-volume Client.InternalError |
The Auto Scaling role may lack key access | Check the customer managed keyAn encryption key you create and control in AWS KMS. policy and grantsA KMS permission delegation that authorizes specified operations on a key. |
Launch errors · EC2 error meanings · AMI errors
An instance profileAn IAM container that supplies a role to applications on an EC2 instance. supplies a role to software running on EC2. A service-linked roleAn IAM role linked to a service that lets it perform actions on your behalf. supplies permissions to Auto Scaling itself. For customer managed EBS encryption keys, the latter needs key use and kms:CreateGrant. Cross-account keys additionally need a grant to that role, meaning an explicit KMS permission delegation.
Exam cues
- If the question says sufficient quota but no instance capacity, think more suitable types or AZs, because quota and available hardware are different constraints.
- If the question says encrypted launches fail despite instance-role permissions, think the Auto Scaling service-linked role, because that service launches the encrypted resources.
- If the question says the template includes an instance profile and its caller is denied, think
iam:PassRole, because the caller must be allowed to pass that role. - If the question says launches remain suspended after repair, think resume the affected process, because administrative suspensionAn Auto Scaling process suspension imposed by the service after repeated launch failures. can outlast the original error.
Remember
- Scaling activity historyThe Auto Scaling record of scaling operations, their status, and failure details. covers six weeks.
DryRunOperationis a successful permission-check result;UnauthorizedOperationis not.- AMI and instance processor architectures must match.
- The default AWS managed EBS key needs no additional Auto Scaling authorization in the same account.
Trap: Granting decrypt permission to the instance role does not give the Auto Scaling service-linked role permission to launch customer-key-encrypted volumes.
From the AWS docs (16)
- Auto Scaling activity history is available on the group Activity tab or through describe-scaling-activities; StatusCode and StatusMessage identify failures.
- Auto Scaling retains six weeks of scaling activity history.
- A fully-formed-launch-template error has a more specific cause in its following message; run-instances with --dry-run can help diagnose the template.
- DryRunOperation means the EC2 dry-run permission check succeeded; UnauthorizedOperation indicates missing permission.
- A launch-template caller needs ec2:RunInstances, ec2:CreateTags when launch tags are specified, and iam:PassRole when the template includes an instance profile.
- A private AMI owned by another account must be shared with the launching account.
- A deleted, pending, or disabled AMI can prevent an Auto Scaling launch; use a valid available AMI.
- The AMI processor architecture must match the selected instance type.
- Deleted security groups or key pairs referenced by launch settings prevent launch and require corrected launch settings on the group.
- Insufficient instance capacity can be addressed by waiting, enabling additional AZs, or using additional suitable instance types.
- An EC2 instance quota error requires reducing instance use or requesting a quota increase, rather than treating it as an AZ capacity shortage.
- InsufficientFreeAddressesInSubnet means the subnet lacks enough free addresses for the request.
- Encrypted EBS launches using a customer managed KMS key require access for the Auto Scaling service-linked role, not just the role attached to the instance.
- The customer managed key policy must allow key use and kms:CreateGrant for the service-linked role; a cross-account key also requires a grant to that role.
- Auto Scaling needs no additional authorization to use the default AWS managed EBS key in the same account.
- Auto Scaling can administratively suspend processes after repeated launch failures; suspended processes can be resumed after repair.
Refresh checkpoints and rollback
CheckpointsA configured percentage of replaced instances at which an instance refresh pauses. pause an instance refreshAn operation that replaces group instances using an updated instance configuration. after part of the fleet is replaced. RollbackReplacing instances deployed during a refresh with instances matching the previous saved group configuration. restores the configuration saved before the refresh. Together they let operators inspect partial deployment and respond to health or application alarms.
How it works
- Save a stable previous configuration with a numbered launch templateA versioned set of settings used to launch an EC2 instance. version. Start the refresh with an explicit desired configurationThe launch settings that an instance refresh should deploy to the group. so rollback is available.
- Configure checkpoint percentages to pause replacement in phases. Checkpoint delay controls how long each pause lasts.
- Configure CloudWatch alarms and enable auto rollback. An alarm entering ALARM can fail the refresh; rollback replaces instances deployed so far with the previous configuration.
- Set bake timeThe final observation wait before an instance refresh is considered complete. if the complete fleet needs observation before the operation finishes. Bake time is a final wait, separate from the pauses at checkpoints.
- Use EventBridge refresh events for checkpoint notifications and refresh or rollback outcomes. Delivery is best effort.
| Instance condition | Available actions | Default |
|---|---|---|
| Scale-inRemoving instance capacity from an Auto Scaling group. protected | Refresh, Ignore, Wait | CLI/SDK Wait; console Ignore |
| StandbyAn Auto Scaling instance state that pauses Auto Scaling health checks until the instance returns to service. | Terminate, Ignore, Wait | CLI/SDK Wait; console Ignore |
| Already matches desired settings | Skip matching | Keep matching instances |
Exam cues
- If the question says inspect a partial image rollout, think checkpoints, because replacement pauses at configured percentages.
- If the question says application errors should restore the old configuration, think alarms plus auto rollback, because an alarm can fail the refresh and trigger recovery.
- If the question says rollback is unavailable with $Latest, think pin a numbered template version and supply desired configuration, because rollback requires those settings.
- If the question says automation must react to a refresh failure, think EventBridge refresh state events, because they describe the operation outcome.
Remember
- Checkpoint delay defaults to 3600 seconds; bake time defaults to zero.
- Wait for protected or Standby instances allows one hour before failure.
- Active replacement can last at most 14 days.
- Rollback does not support $Latest, $Default or a Parameter Store AMIA template containing the software configuration used to launch an instance. alias.
Trap: An alarm can fail a refresh without restoring the old configuration when auto rollback is off. After a refresh completes, reverting requires a new refresh.
From the AWS docs (15)
- Instance refresh checkpoints pause replacement at configured percentages so operators can evaluate a partial deployment.
- Checkpoint delay defaults to 3600 seconds when checkpoints are used.
- Bake time is the wait at the end of instance refresh before it is considered complete; its default is zero.
- A configured CloudWatch alarm entering ALARM can fail a refresh; enabling auto rollback restores the previous configuration after failure.
- Rollback replaces instances deployed so far with instances matching the configuration saved on the group before the refresh.
- Rollback requires specifying a desired configuration when starting the refresh.
- Rollback requires a specific numbered launch template version; it is not available for $Latest or $Default.
- Rollback cannot restore a launch template using an AMI alias from Systems Manager Parameter Store.
- Rollback is available only while a refresh is in progress; after completion, reverting requires a new refresh.
- Scale-in protected instances can be replaced with Refresh, skipped with Ignore or waited on for one hour with Wait before failure.
- Standby instances can be terminated with Terminate, skipped with Ignore or waited on for one hour with Wait before failure.
- For protected and Standby instances, CLI and SDK default to Wait while the console defaults to Ignore.
- Skip matching keeps instances already matching the desired launch template and instance types.
- Auto Scaling emits best-effort EventBridge events for checkpoints, refresh start, success, failure, cancellation and rollback start, success or failure.
- A refresh can actively replace instances for at most 14 days.
Launch and scaling operations
EC2 Auto Scaling operations depend on launch permissions, lifecycle decisions and scaling settings. Knowing where each setting applies helps diagnose failed launches and control what happens as instances enter or leave a group.
How it works
- Choose Reservations then balanced to fill targeted Capacity Reservations before distributing remaining capacity evenly. Supply a reservation ID or Capacity Reservation resource group.
- For launch authorization errors, check
ec2:RunInstances,ec2:CreateTagswhen tags are specified, andiam:PassRolewhen an instance profileAn IAM container that supplies a role to applications on an EC2 instance. is specified. A private AMIA template containing the software configuration used to launch an instance. from another account must be shared with the group account. See launch templateA versioned set of settings used to launch an EC2 instance. troubleshooting. - For encrypted EBS volumes, allow the Auto Scaling service-linked roleAn IAM role linked to a service that lets it perform actions on your behalf. to use the customer managed KMS key and create grantsA KMS permission delegation that authorizes specified operations on a key. in its key policy. For a cross-account key, also allow the Auto Scaling account in the key policy and create a grant for its service-linked role.
- Complete a lifecycle action with
CompleteLifecycleAction, or extend its wait withRecordLifecycleActionHeartbeatwithin the overall timeout. On launch,CONTINUEpermits service entry andABANDONpermits termination and replacement. On termination,CONTINUEallows remaining hooks to complete, whileABANDONskips them. See completing lifecycle actions and hook considerations. - Route lifecycle wait and scaling outcome events with EventBridge rules, filtering source
aws.autoscalingand event type. Lifecycle notifications can target Lambda, SNS or SQS. A direct SNS or SQS hook target needs an IAM role that permits Auto Scaling to publish. - For scaling event email, create an SNS topic, subscribe and confirm the email address, then configure group notification types. Both SNS delivery and EventBridge events are best effort.
| SNS notification type | Outcome |
|---|---|
autoscaling:EC2_INSTANCE_LAUNCH |
Successful launch |
autoscaling:EC2_INSTANCE_LAUNCH_ERROR |
Failed launch |
autoscaling:EC2_INSTANCE_TERMINATE |
Successful termination |
autoscaling:EC2_INSTANCE_TERMINATE_ERROR |
Failed termination |
Exam cues
- If the question says a launch hook times out without a configured result, think
ABANDON, because it is the default and permits termination and replacement. - If the question says route different lifecycle waits or scaling failures to automation, think EventBridge rules, because they filter events by source and type.
- If the question says target trackingA scaling policy that adjusts capacity to keep a utilization metric near a target. has no policy warmupThe initialization period during which a new instance is excluded from aggregated instance metrics. or group default warmup, think group default cooldownA pause after a scaling activity before another simple scaling activity can begin., because it is the fallback.
- If the question says an empty warm poolA set of initialized instances kept alongside an Auto Scaling group for faster scale-out. must scale out, think a cold start directly into the group, because scale-outAdding instance capacity to an Auto Scaling group. is subject to maximum capacity.
- If the question says a group cannot be created, think regional group quota, because the default is 500 groups per Region. EC2 and VPC quotas can also constrain a group.
Remember
- The lifecycle hookA pause during instance launch or termination that allows a custom action to finish. heartbeatA signal that extends a lifecycle action wait within its overall timeout. timeout defaults to 1 hour. The global timeout is the smaller of 48 hours or 100 times the heartbeat timeout. The default result on timeout or unexpected failure is
ABANDONunless configured otherwise. See hook considerations and PutLifecycleHook. - Predictive scaling needs at least 24 hours of data and analyzes up to 14 days. It forecasts hourly capacity for 48 hours and updates the forecast every 6 hours.
- Warm-pool sizing defaults to group maximum capacity minus desired capacityThe amount of instance capacity an Auto Scaling group tries to maintain..
MaxGroupPreparedCapacityreplaces the maximum in that calculation;MinSizesets a minimum, with none set by default.
Trap:
ABANDONhas different effects at launch and termination. A launch can be terminated and replaced; a termination proceeds while remaining hooks are skipped.
From the AWS docs (28)
- Reservations then balanced fills targeted Capacity Reservations before distributing remaining capacity evenly; a reservation ID or Capacity Reservation resource group is required.
- Launch template authorization requires ec2:RunInstances, ec2:CreateTags when tags are specified, and iam:PassRole when an instance profile is specified. A private cross-account AMI must be shared.
- The default quota is 500 Auto Scaling groups per Region; increases can be requested for supported quotas, and EC2 and VPC quotas can also constrain a group.
- A customer managed KMS key for encrypted Auto Scaling EBS volumes needs a key policy allowing the service-linked role to use the key and create grants.
- A KMS key in another account needs a key policy allowing the Auto Scaling account and a grant to the Auto Scaling service-linked role.
- 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.
- CONTINUE on a termination hook permits termination after any remaining lifecycle hooks complete.
- ABANDON on a termination hook permits termination and skips remaining hooks.
- The default lifecycle hook heartbeat timeout is one hour.
- A lifecycle hook global timeout is the smaller of 48 hours or 100 times its heartbeat timeout.
- CompleteLifecycleAction completes a lifecycle action and RecordLifecycleActionHeartbeat extends its wait within the overall timeout.
- The autoscaling:EC2_INSTANCE_LAUNCH SNS notification reports a successful launch.
- The autoscaling:EC2_INSTANCE_LAUNCH_ERROR SNS notification reports a failed launch.
- The autoscaling:EC2_INSTANCE_TERMINATE SNS notification reports successful termination.
- The autoscaling:EC2_INSTANCE_TERMINATE_ERROR SNS notification reports failed termination.
- To receive Auto Scaling event email, create an SNS topic, subscribe and confirm the email address, then configure group notification types; delivery is best effort.
- Auto Scaling emits best-effort EventBridge events with source aws.autoscaling for lifecycle wait states and successful or failed scaling actions.
- EventBridge rules can filter lifecycle notifications and route them to Lambda, SNS or SQS.
- When a lifecycle hook times out or has an unexpected failure, its default result is ABANDON unless configured otherwise.
- A direct SNS or SQS lifecycle hook notification target requires an IAM role that allows Auto Scaling to publish to the target.
- Predictive scaling requires at least 24 hours of metric data and analyzes up to 14 days of history.
- Predictive scaling produces an hourly forecast for the next 48 hours and updates it every 6 hours.
- When policy warmup is omitted, target tracking uses group default instance warmup, or group default cooldown if default warmup is unset.
- By default warm-pool size is group maximum capacity minus desired capacity.
- MaxGroupPreparedCapacity replaces group maximum capacity in the warm-pool sizing calculation.
- MinSize sets a minimum warm-pool size; by default no minimum is set.
- An empty warm pool causes scale-out to launch directly into the group as a cold start, subject to maximum capacity.
Flashcards
Nothing to review here right now. Pick other topics or another filter.
·
All 91 cards as a list
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.
An EC2 Auto Scaling fleet needs a new machine image while keeping serving capacity during replacement. Which feature and health settings apply?
Instance refresh. Set the healthy capacity budget; minimum and maximum healthy percentages of 100 launch replacements before terminating, one at a time.
An EC2 Auto Scaling launch template was updated, but existing instances still run the old image. What should the team start?
An instance refresh. A template update affects future launches and does not replace existing instances.
How should a team replace EC2 Auto Scaling instances after publishing a new machine image?
Use an updated launch template as the instance refresh configuration, then run and monitor the refresh. It replaces the existing instances.
Which EC2 Auto Scaling instance refresh defaults apply without an instance maintenance policy?
Minimum healthy 90%, maximum healthy 100%. Warmup uses group default instance warmup, then health check grace period. Alarms, auto rollback and checkpoints are off; bake time is zero.
An EC2 Auto Scaling group scales out during an instance refresh. Which launch settings do those new instances use?
The refresh desired configuration. After the refresh succeeds, that configuration is saved to the group.
An EC2 Auto Scaling instance refresh should leave instances that match the desired configuration alone. Which setting applies?
Skip matching. It defaults to enabled in the console and disabled in CLI or SDK requests. It cannot detect updated code downloaded by unchanged user data; disable it when every instance must rerun setup.
An EC2 Auto Scaling instance refresh must wait for application stabilization after replacement health checks pass. Which control does this?
Instance warmup. Refresh waits for that period before moving to further replacements.
How long can an EC2 Auto Scaling instance refresh actively replace instances?
At most 14 days.
Where should an operator find the reason an EC2 Auto Scaling group cannot launch instances?
Read the group Activity history or describe-scaling-activities, especially StatusCode and StatusMessage. Six weeks of activity history is available.
An EC2 Auto Scaling group reports insufficient instance capacity in its configured AZs, but its account quota is sufficient. What should the operator change?
Try additional suitable instance types or enabled AZs, or retry after capacity changes. A quota increase does not by itself create physical capacity.
An EC2 Auto Scaling group reports an EC2 instance quota has been reached. Is choosing a different AZ enough?
No. Reduce instance use or request the relevant quota increase. A quota error differs from a temporary instance-capacity shortage.
An EC2 Auto Scaling launch fails after a team selects a customer managed KMS key for its EBS volumes. The instance role can decrypt. Which permission path still needs checking?
The Auto Scaling service-linked role needs key-policy access and CreateGrant permission. A cross-account key also needs a grant to that role.
An EC2 Auto Scaling user can read a launch template but gets an authorization error when the template includes an instance profile. What permission is relevant?
iam:PassRole for the role in the instance profile, alongside the EC2 launch permissions.
An EC2 Auto Scaling group reports a generic fully-formed-launch-template error. How can an operator narrow down the cause without launching an instance?
Read the specific message following the generic error and test the selected template version with run-instances --dry-run. DryRunOperation indicates the permission check succeeded.
An EC2 Auto Scaling group uses an Arm instance type with an x86 AMI. What must change?
Select an AMI and instance type with matching processor architectures.
An EC2 Auto Scaling launch reports InsufficientFreeAddressesInSubnet. Which resource is exhausted?
The subnet free IP address pool. Check subnet address capacity rather than raising the EC2 instance quota.
An EC2 Auto Scaling launch configuration has been repaired, but launches remain stopped after repeated failures. What group setting should an operator inspect?
Suspended processes. Auto Scaling can impose an administrative suspension after repeated launch failures; resume the affected process after fixing the cause.
How can an EC2 Auto Scaling team reduce instance refresh deployment risk?
Use checkpoints to inspect partial deployment, alarms with auto rollback for failure recovery, and skip matching to keep matching instances. Explicitly choose how protected and Standby instances are handled.
An EC2 Auto Scaling image rollout must pause in phases and revert if error alarms fire. Which settings apply?
Instance refresh checkpoints, a configured CloudWatch alarm and auto rollback. Bake time adds observation time at the end. Checkpoint delay defaults to one hour; active replacement is limited to 14 days.
An EC2 Auto Scaling group uses $Latest for its launch template version. Can its instance refresh use rollback?
No. Rollback needs a specific numbered version and a desired configuration supplied when the refresh starts. Parameter Store AMI aliases are also unsupported for rollback.
An EC2 Auto Scaling refresh completed successfully, but an application problem was found afterward. Can the completed operation be rolled back?
No. Start a new refresh to deploy the previous configuration. Rollback is only available while a refresh is in progress.
An EC2 Auto Scaling refresh started through the CLI stops at protected or Standby instances. Which default explains this?
Wait. It gives one hour to remove protection or return the instance to service before failure; the console defaults to Ignore.
An EC2 Auto Scaling team wants automation when refresh checkpoints or rollback outcomes occur. Which event source applies?
Auto Scaling instance refresh events in EventBridge. Events cover checkpoints and refresh or rollback state changes and are best effort.
An EC2 Auto Scaling group must use its Capacity Reservations before balancing remaining instances across Availability Zones. What does it configure?
Reservations then balanced, with a reservation ID or Capacity Reservation resource group as the target.
An EC2 Auto Scaling launch template specifies tags, an instance profile and a private AMI owned by another account. What should an administrator check after an authorization error?
Check ec2:RunInstances, ec2:CreateTags and iam:PassRole permissions, and ensure the AMI is shared with the group account.
An account cannot create another EC2 Auto Scaling group in a Region. Which default quota should it check?
The default is 500 groups per Region. Check Service Quotas for the account's actual limit and request an increase if needed.
EC2 Auto Scaling cannot launch instances with EBS volumes encrypted by a customer managed KMS key in another account. What access must be configured?
Allow key use and grant creation in the key policy, then create a cross-account grant for the Auto Scaling service-linked role.
What does ABANDON do for EC2 Auto Scaling launch and termination lifecycle hooks?
On launch, it permits termination and replacement. On termination, it permits termination and skips remaining hooks; CONTINUE lets remaining hooks complete.
How long can an EC2 Auto Scaling lifecycle hook wait, and how can automation keep it alive?
Heartbeat timeout defaults to one hour. RecordLifecycleActionHeartbeat extends the wait, up to the smaller of 48 hours or 100 times the heartbeat timeout.
An EC2 Auto Scaling team needs emails for successful launches and terminations. What configuration is required?
Configure an SNS topic with a confirmed email subscription and the group notification types autoscaling:EC2_INSTANCE_LAUNCH and autoscaling:EC2_INSTANCE_TERMINATE.
An EC2 Auto Scaling team wants different automation for launch waits, termination waits and scaling failures. What should route the events?
EventBridge rules filtering source aws.autoscaling and the event type, then routing matching notifications to the required targets.
An EC2 Auto Scaling launch lifecycle hook times out without an explicit default result. What happens to the instance?
The default is ABANDON, which permits Auto Scaling to terminate and replace the instance.
An EC2 Auto Scaling lifecycle hook sends notifications directly to an Amazon SQS queue. What permission configuration does the hook need?
An IAM role that allows Auto Scaling to publish to the queue.
How much history does EC2 Auto Scaling predictive scaling need, and how far ahead does it forecast?
At least 24 hours of data; up to 14 days are analyzed. It forecasts hourly capacity for 48 hours and updates the forecast every 6 hours.
An EC2 Auto Scaling target tracking policy has no warmup override or group default warmup. Which fallback applies?
The group default cooldown. Configure group default instance warmup to give policies a shared initialization period.
How is an EC2 Auto Scaling warm pool sized by default, and what changes the calculation?
Maximum group capacity minus desired capacity. MaxGroupPreparedCapacity supplies a separate prepared-capacity limit; MinSize can maintain a minimum pool size.
An EC2 Auto Scaling warm pool is empty when demand rises. Does scale-out have to wait for it to refill?
No. Instances can cold-start directly into the group, subject to maximum capacity.