Auto Scaling Group Auditor
Mindset
One-line takeaway: the verdict is always the worst finding across all
dimensions, and three ASG misconfigurations are silent killers —
HealthCheckType=ELB with no target group (infinite replacement loop),
launch-configuration usage (locked out of IMDSv2 and mixed-instances), and a
single Spot instance type (one interruption takes down everything).
An Auto Scaling Group is the elasticity engine of EC2 workloads. Its
configuration sits at the intersection of launch infrastructure (templates,
AMIs, IMDSv2), health detection (ELB vs EC2 checks, grace periods), capacity
planning (min/max/desired bounds, Spot diversification), and failure recovery
(termination policies, capacity rebalance). A misconfiguration in any
dimension produces silent degradation — the ASG keeps running but instances
cycle, apps hang undetected, or Spot interruptions cascade.
- ELB health check with no target group is a silent infinite loop: the
ASG launches, the ELB never reports health, the ASG terminates and relaunches
— indefinitely. It looks like "high churn," not an obvious error.
- Launch configuration is a technical-debt dead end: deprecated for new
creation (Dec 2023), incompatible with MixedInstancesPolicy, and cannot
enforce IMDSv2.
- Single Spot instance type is a total-outage vector: one Spot
interruption event affects 100% of Spot capacity.
Quick reference — verdict thresholds
| Condition |
Verdict |
Rule |
HealthCheckType includes ELB + no target group / LB attached |
MISCONFIGURED |
Step 3 |
LaunchConfigurationName set (legacy LC) |
MISCONFIGURED |
Step 1 |
DesiredCapacity > MaxSize or < MinSize |
MISCONFIGURED |
Step 2 |
| MIP with 1 instance type + Spot allocation (< 100% On-Demand) |
MISCONFIGURED |
Step 5 |
Launch template HttpTokens != required |
CONFIG_GAP |
Step 1 |
HealthCheckGracePeriod < 60 + ELB health check |
CONFIG_GAP |
Step 3 |
HealthCheckType: EC2 + target group / LB attached |
CONFIG_GAP |
Step 4 |
Spot allocation + CapacityRebalance.Enabled != true |
CONFIG_GAP |
Step 6 |
Single AZ only (AvailabilityZones has 1 entry) |
CONFIG_GAP |
Step 7 |
MaxSize == DesiredCapacity (no scale-out headroom) |
CONFIG_GAP |
Step 8 |
| All dimensions pass |
OK |
Step 9 |
See the ordered steps below for edge cases. Deep ASG lifecycle internals
(health-check evaluation pipeline, Spot rebalance timing, AZ rebalancing) are
in the Deep reference section.
Pre-flight: ASG metadata gate (run before classification)
Before evaluating the ASG configuration, classify the ASG's lifecycle state
and launch source. Several attributes short-circuit the audit —
misclassifying them produces false positives.
| Attribute |
Value |
Effect on audit |
LaunchConfigurationName |
set |
Legacy launch configuration. Immediately MISCONFIGURED (Step 1). LCs are deprecated (no new creation since Dec 2023), cannot enforce IMDSv2, and are incompatible with MixedInstancesPolicy. |
LaunchTemplate |
set |
Proceed with full audit. This is the modern path. |
MixedInstancesPolicy |
set |
The ASG uses MIP — evaluate instance-type diversification (Step 5). MIP overrides the top-level LaunchTemplate. |
SuspendedProcesses |
includes HealthCheck |
Suspended health checks. The ASG will not replace unhealthy instances. Flag as operational risk — but classify the rest of the config normally. |
SuspendedProcesses |
includes Launch / Terminate |
Scaling is frozen. The ASG cannot launch or terminate. Flag as operational risk. |
If the ASG configuration is malformed (missing required fields like
MinSize, MaxSize, HealthCheckType), output:
ASG: <name>
VERDICT: ERROR
REASON: ASG configuration is missing required fields — cannot classify.
REMEDIATION: Retrieve the canonical config with
aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names <name> --output json
and re-audit.
Process — Classification logic (apply in order, aggregate worst)
Step 0: Expert knowledge — non-obvious ASG behaviors that change classification
Deep dive moved to references/advanced-patterns.md
(Step 0: non-obvious ASG behaviors) — load before classifying edge-case ASGs.
Step 1: Launch template / configuration health
Evaluate the launch source:
MISCONFIGURED if LaunchConfigurationName is set. Launch configurations
are deprecated (no new creation since Dec 2023), cannot enforce IMDSv2, and
are incompatible with MixedInstancesPolicy. This is a tech-debt dead end.
CONFIG_GAP if LaunchTemplate is set but MetadataOptions.HttpTokens
is not "required". IMDSv2 is not enforced — the instance metadata service
is accessible via IMDSv1, which is vulnerable to SSRF attacks. An attacker
who can make the instance call 169.254.169.254 can steal IAM instance
profile credentials.
OK for this dimension if LaunchTemplate is set with
HttpTokens: "required".
Step 2: Capacity configuration
Evaluate the min/max/desired bounds:
MISCONFIGURED if DesiredCapacity > MaxSize or
DesiredCapacity < MinSize. The ASG will immediately launch or terminate
instances to reach desired, but the desired value is logically inconsistent
with the bounds. describe-auto-scaling-groups may show the desired value
the user set, but the ASG corrects it silently — relying on silent
correction is a production hazard.
CONFIG_GAP if MinSize is 0 for a production ASG. With MinSize=0, the
ASG can scale to zero — the first scale-out has a cold start (AMI fetch +
userdata + ELB registration: 3-5 minutes). For production workloads,
MinSize >= 2 (one per AZ minimum) maintains baseline capacity.
Step 3: ELB health check integrity
Evaluate the ELB health check wiring:
MISCONFIGURED if HealthCheckType includes "ELB" AND both
TargetGroupARNs and LoadBalancerNames are empty or missing. No ELB is
attached to report health — instances are treated as Unhealthy from launch,
creating an infinite replacement loop. This is the most costly silent
misconfiguration in Auto Scaling.
CONFIG_GAP if HealthCheckType includes "ELB" AND
HealthCheckGracePeriod < 60. ELB target registration alone takes 30-60
seconds. A grace period under 60 seconds gives the application near-zero
time to boot and register before being evaluated — healthy instances get
terminated prematurely.
Step 4: Health check type appropriateness
Evaluate whether the health check type matches the traffic architecture:
- CONFIG_GAP if
HealthCheckType is "EC2" (or does not include ELB) AND
(TargetGroupARNs is non-empty OR LoadBalancerNames is non-empty). An ELB
is attached but the ASG only checks EC2 status checks — a hung application
(process alive but not serving) is not detected. Use HealthCheckType: ELB
or "ELB,EC2" for ASGs that front traffic via a load balancer.
Step 5: Mixed-instances policy evaluation
Evaluate Spot diversification and allocation:
MISCONFIGURED if MixedInstancesPolicy exists AND the Overrides list
has exactly 1 instance type AND Spot allocation is in use
(OnDemandPercentageAboveBaseCapacity < 100). A single Spot instance type
means the next Spot interruption affects 100% of Spot capacity. Diversify
across 3+ instance types to survive pool-level interruptions.
CONFIG_GAP if no MixedInstancesPolicy exists AND the ASG uses a
LaunchTemplate (not LC). MIP provides instance-type flexibility, Spot
cost optimization, and AZ-aware allocation — all unavailable with a bare
launch template. This is a recommended-practice gap, not an active failure.
Step 6: Capacity rebalance (Spot)
- CONFIG_GAP if Spot allocation is in use
(
OnDemandPercentageAboveBaseCapacity < 100 within a MixedInstancesPolicy)
AND CapacityRebalance.Enabled is not true. Without Capacity Rebalance,
the ASG only reacts after a Spot instance is terminated — it does not
proactively launch a replacement on the rebalance recommendation. This
creates a capacity gap during the replacement window.
Step 7: AZ diversity
- CONFIG_GAP if
AvailabilityZones has exactly 1 entry (or
VPCZoneIdentifier references subnets in a single AZ). A single-AZ ASG has
no resilience — an AZ outage takes down the entire fleet. Minimum 2 AZs for
production; 3+ for high availability.
Step 8: Scale-out headroom
- CONFIG_GAP if
MaxSize == DesiredCapacity. The ASG can only scale in,
never out. If traffic spikes, there is zero elasticity. This may be
intentional for fixed-size groups, but for auto-scaling workloads it defeats
the purpose. Ensure MaxSize > DesiredCapacity for a meaningful scale-out
margin.
Step 9: Aggregation — worst finding wins
The final verdict is the maximum severity across all findings, where
MISCONFIGURED > CONFIG_GAP > OK:
verdict = max(all_finding_severities)
If no findings (all dimensions pass), the verdict is OK.
Output format (per ASG)
ASG: <name>
VERDICT: MISCONFIGURED | CONFIG_GAP | OK
REASON: <1-2 sentences citing the worst finding and its step number>
FINDINGS:
- [MISCONFIGURED] <finding description (Step N)>
- [CONFIG_GAP] <finding description (Step N)>
- [OK] <dimension that passed>
REMEDIATION: <specific action per finding, or "None required" if OK>
Worked example — Spot single instance type
ASG: prod-spot-asg
VERDICT: MISCONFIGURED
REASON: MixedInstancesPolicy has 1 instance type (c5.large) with Spot
allocation (OnDemandPercentageAboveBaseCapacity=0) — a single Spot interruption
affects 100% of capacity (Step 5). CapacityRebalance is also disabled,
compounding the risk.
FINDINGS:
- [MISCONFIGURED] Single Spot instance type (c5.large) with 0% On-Demand —
no diversification against pool-level interruption (Step 5)
- [CONFIG_GAP] CapacityRebalance.Enabled is false on a Spot-backed ASG —
no proactive replacement on rebalance recommendation (Step 6)
- [OK] Launch template with IMDSv2 required (Step 1)
REMEDIATION:
1. Add 2+ instance types to Overrides (e.g., c5.large, c5a.large, m5.large)
to diversify Spot pools.
2. Set SpotAllocationStrategy to capacity-optimized to minimize
interruptions.
3. Enable CapacityRebalance:
aws autoscaling create-or-update-tags --tags
Key=capacity-rebalance,Value=true,...
(or update via create-auto-scaling-group / update-auto-scaling-group
with --capacity-rebalance)
Anti-Patterns — NEVER
NEVER classify HealthCheckType: ELB with no target group as anything other
than MISCONFIGURED. Without an attached ELB, no health data is returned —
every instance is Unhealthy from launch, creating an infinite replacement
loop. This is not "suboptimal" — it is actively burning compute budget.
NEVER treat a launch configuration as equivalent to a launch template. LCs
are deprecated, cannot enforce IMDSv2, and are incompatible with
MixedInstancesPolicy. Any ASG using LaunchConfigurationName is locked out
of modern EC2 features.
NEVER assume HealthCheckGracePeriod is measured from ELB registration. It
is measured from instance launch. ELB registration takes 30-60s — a
60s grace period gives the app near-zero warmup time. Treat < 60s with ELB
checks as a CONFIG_GAP.
NEVER classify a single Spot instance type in a MixedInstancesPolicy as
CONFIG_GAP. With Spot allocation (OnDemandPercentageAboveBaseCapacity < 100), a single instance type means one interruption event affects 100% of
capacity. This is MISCONFIGURED — the ASG will lose all Spot capacity on
the next pool drain.
NEVER assume HealthCheckType: EC2 detects application failure. EC2 status
checks verify hypervisor-level health only. A hung application (process
alive, port open, not serving requests) passes EC2 checks. If the ASG has
a target group attached, the health check type should include ELB.
NEVER treat OnDemandPercentageAboveBaseCapacity as the total On-Demand
percentage. It applies above OnDemandBaseCapacity. Base=2, Percent=50
means the first 2 instances are On-Demand, then 50% of the remainder. The
effective On-Demand ratio depends on DesiredCapacity.
NEVER set SpotAllocationStrategy: capacity-optimized and also set
SpotInstancePools. SpotInstancePools only applies to lowest-price.
With capacity-optimized, SpotInstancePools is dead configuration — it
has no effect. Do not rely on it for diversification.
NEVER assume $Latest launch template version is safe for production. When
the template is updated, $Latest immediately redirects. New instances use
the new version while old instances keep theirs — fleet split. If the new
version is broken, new instances fail and cycle infinitely. Pin a specific
version number for production ASGs.
NEVER assume an ASG with MaxSize == DesiredCapacity can scale. It can only
scale in. For auto-scaling workloads, ensure MaxSize > DesiredCapacity.
This is CONFIG_GAP, not MISCONFIGURED — the ASG works, it just has no
scale-out elasticity.
NEVER assume Standby instances free up capacity. Standby instances count
against MaxSize but not DesiredCapacity. If MaxSize is tight, Standby
instances block scale-out. Check Standby count before scaling operations.
NEVER modify an ASG's launch template without considering the instance
refresh. Changing $Latest or pinning a new version does not automatically
update existing instances — they keep their old version until replaced. Use
aws autoscaling start-instance-refresh to roll out the change safely.
NEVER ignore SuspendedProcesses. An ASG with HealthCheck suspended will
not replace unhealthy instances. An ASG with Launch or Terminate
suspended cannot scale at all. Always check suspended processes before
classifying capacity or health behavior.
Pre-flight safety checks (run before any remediation CLI)
MANDATORY CONFIRMATION GATE. Before any state-changing operation
(UpdateAutoScalingGroup, StartInstanceRefresh, PutScalingPolicy,
DetachLoadBalancerTargetGroups), the auditor MUST emit:
CONFIRM: About to <action> on ASG <name> in account <account>. This affects <consequence>. Proceed? (yes/no)
Snapshot the current ASG config for rollback:
aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names <name> --output json > /tmp/<name>-backup-$(date +%s).json
BEFORE any modification. ASG configs are not versioned — there is no undo
without a backup.
Instance refresh safety. Before starting an instance refresh to roll out
a new launch template version, verify: (1) MinHealthyPercentage is set
(default 90 — too high for small ASGs); (2) the new template version has
been tested on a canary instance or non-prod ASG; (3) the ASG's health
check grace period is long enough for the new AMI/userdata to complete
boot. A failed instance refresh can take down the entire fleet.
Capacity bounds check. Before changing MinSize/MaxSize/DesiredCapacity,
verify the new values are internally consistent (MinSize <= DesiredCapacity
<= MaxSize) and that the account has sufficient On-Demand or Spot capacity
in the target AZs. Use
aws service-quotas get-service-quota --service-code autoscaling --quota-code L-...
to check ASG resource limits.
Spot allocation warning. Before increasing Spot percentage or adding
instance types, check
aws ec2 describe-spot-price-history for recent price stability in the
target AZs. A pool that was stable yesterday may be under pressure today.
Remediation guidance
For MISCONFIGURED — ELB health check with no target group (Step 3)
- Attach the target group:
aws autoscaling attach-load-balancer-target-groups --auto-scaling-group-name <name> --target-group-arns <arn>
- Verify the target group has a configured health check:
aws elbv2 describe-target-groups --target-group-arns <arn>
The health check path, interval, and healthy threshold must match the
application's boot time.
- If the ASG should NOT use ELB health checks (e.g., background workers),
switch:
aws autoscaling update-auto-scaling-group --auto-scaling-group-name <name> --health-check-type EC2
For MISCONFIGURED — legacy launch configuration (Step 1)
- Create a launch template from the launch configuration:
aws ec2 create-launch-template --launch-template-name <name> --launch-template-data file://template.json
- Update the ASG to use the template:
aws autoscaling update-auto-scaling-group --auto-scaling-group-name <name> --launch-template LaunchTemplateId=<id>,Version=1
- Start an instance refresh to roll existing instances to the new template:
aws autoscaling start-instance-refresh --auto-scaling-group-name <name>
For MISCONFIGURED — single Spot instance type (Step 5)
- Add 2+ instance types to the MIP Overrides. Choose types with similar
vCPU/memory (e.g., c5.large, c5a.large, m5.large).
- Set
SpotAllocationStrategy: capacity-optimized to minimize interruptions.
- Enable CapacityRebalance:
aws autoscaling update-auto-scaling-group --auto-scaling-group-name <name> --capacity-rebalance
For CONFIG_GAP — IMDSv2 not required (Step 1)
- Update the launch template with a new version enforcing IMDSv2:
aws ec2 create-launch-template-version --launch-template-id <id> --launch-template-data '{"MetadataOptions":{"HttpTokens":"required"}}'
- Update the ASG to use the new version:
aws autoscaling update-auto-scaling-group --auto-scaling-group-name <name> --launch-template LaunchTemplateId=<id>,Version=<n>
- Start an instance refresh to enforce on existing instances.
For CONFIG_GAP — short grace period (Step 3)
- Increase
HealthCheckGracePeriod to at least 300 seconds:
aws autoscaling update-auto-scaling-group --auto-scaling-group-name <name> --health-check-grace-period 300
For CONFIG_GAP — EC2 health check behind ELB (Step 4)
- Switch to ELB health checks:
aws autoscaling update-auto-scaling-group --auto-scaling-group-name <name> --health-check-type ELB
- Verify the target group health check is configured correctly (path, port,
interval, healthy threshold).
For OK
- No remediation required for the current posture.
- Recommend enabling Instance Refresh warmup checks if not already configured.
- Recommend setting
NewInstancesProtectedFromScaleIn: true for stateful
workloads to prevent scale-in from terminating new instances before they
receive traffic.
Deep reference: Auto Scaling internals
Internals moved to references/advanced-patterns.md
(health-check lifecycle, Spot rebalance timing, OnDemand/Spot math, AZ rebalancing) — load on demand.
Recent AWS features (2024-2026)
Feature notes moved to references/advanced-patterns.md.
Load when deciding whether a recent feature changes the audit.
References (load on demand)
- references/advanced-patterns.md — Step-0 expert deep dive, Auto Scaling internals (health-check lifecycle, Spot rebalancing, capacity math, AZ rebalancing), recent AWS features
Domain
AWS CloudOps / Compute Elasticity & Auto Scaling Health.
AWS documentation
1---2name: autoscaling-group-auditor3description: Audits AWS Auto Scaling Groups for launch-template health (legacy launch configuration, IMDSv2), ELB health-check integrity (missing target group, grace-period timing), mixed-instances policy (single Spot instance type, allocation strategy), capacity bounds (desired vs min/max), and unhealthy termination behavior (EC2-only checks behind an ELB, capacity rebalance). Emits a deterministic verdict (MISCONFIGURED | CONFIG_GAP | OK) per ASG with enumerated findings and specific remediation. Use when reviewing ASG configurations, checking launch-template wiring, validating ELB health checks, auditing Spot diversification, or hardening capacity posture.4license: Apache-2.05compatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). No AWS CLI required for offline ASG-config classification. Live-account audits use aws autoscaling describe-auto-scaling-groups, aws ec2 describe-launch-templates, and aws elbv2 describe-target-groups (AWS CLI v2, SSO or key-based credentials).6metadata:7 source: https://skillmd.com/skills/jhkchan/autoscaling-group-auditor8 domain: aws-cloudops9 complexity: high10 requires_llm: 'true'11 phase: '2'12 supports_pipeline: 'true'13 entry_point: 'false'14 family: Compute15 verdict_shape: MISCONFIGURED | CONFIG_GAP | OK16 when_to_use: Reviewing an ASG configuration before production deployment, checking launch-template or launch-configuration wiring, validating ELB health checks and grace-period timing, auditing Spot instance diversification, verifying capacity bounds, or investigating unhealthy-instance replacement loops.17 activation_triggers: audit this auto scaling group, check ASG health check, is my ASG misconfigured, launch template vs launch configuration, ELB health check no target group, spot single instance type, ASG capacity bounds, health check grace period too short, capacity rebalance spot, ASG infinite replacement loop18 invocation_schema: 'Input: either (a) an ASG configuration (launch template/config, capacity bounds, health check settings, mixed-instances policy, AZs), optionally paired with launch-template metadata, OR (b) an ASG name/ARN for live-account audit. Output: deterministic ASG/VERDICT/REASON/FINDINGS/ REMEDIATION block per group, where VERDICT is MISCONFIGURED, CONFIG_GAP, OK, or ERROR.'19 version: 0.1.020 author: Jacky Chan — AWS Community Builder21 keywords: Auto Scaling, ASG, launch template, launch configuration, ELB health check, target group, mixed instances, Spot, capacity, unhealthy termination, IMDSv2, CapacityRebalance, HealthCheckGracePeriod, SpotAllocationStrategy, OnDemandPercentageAboveBaseCapacity, TerminationPolicies, AvailabilityZones, fleet split, ASG audit, auto scaling remediation22 tags: autoscaling, compute, launch-template, elb-health, spot, capacity, mixed-instances, audit23---2425# Auto Scaling Group Auditor2627## Mindset2829**One-line takeaway:** the verdict is always the **worst** finding across all30dimensions, and three ASG misconfigurations are silent killers —31HealthCheckType=ELB with no target group (infinite replacement loop),32launch-configuration usage (locked out of IMDSv2 and mixed-instances), and a33single Spot instance type (one interruption takes down everything).3435An Auto Scaling Group is the elasticity engine of EC2 workloads. Its36configuration sits at the intersection of launch infrastructure (templates,37AMIs, IMDSv2), health detection (ELB vs EC2 checks, grace periods), capacity38planning (min/max/desired bounds, Spot diversification), and failure recovery39(termination policies, capacity rebalance). A misconfiguration in any40dimension produces silent degradation — the ASG keeps running but instances41cycle, apps hang undetected, or Spot interruptions cascade.4243- **ELB health check with no target group** is a **silent infinite loop**: the44 ASG launches, the ELB never reports health, the ASG terminates and relaunches45 — indefinitely. It looks like "high churn," not an obvious error.46- **Launch configuration** is a **technical-debt dead end**: deprecated for new47 creation (Dec 2023), incompatible with MixedInstancesPolicy, and cannot48 enforce IMDSv2.49- **Single Spot instance type** is a **total-outage vector**: one Spot50 interruption event affects 100% of Spot capacity.5152## Quick reference — verdict thresholds5354| Condition | Verdict | Rule |55|---|---|---|56| `HealthCheckType` includes ELB + no target group / LB attached | **MISCONFIGURED** | Step 3 |57| `LaunchConfigurationName` set (legacy LC) | **MISCONFIGURED** | Step 1 |58| `DesiredCapacity > MaxSize` or `< MinSize` | **MISCONFIGURED** | Step 2 |59| MIP with 1 instance type + Spot allocation (< 100% On-Demand) | **MISCONFIGURED** | Step 5 |60| Launch template `HttpTokens != required` | **CONFIG_GAP** | Step 1 |61| `HealthCheckGracePeriod < 60` + ELB health check | **CONFIG_GAP** | Step 3 |62| `HealthCheckType: EC2` + target group / LB attached | **CONFIG_GAP** | Step 4 |63| Spot allocation + `CapacityRebalance.Enabled != true` | **CONFIG_GAP** | Step 6 |64| Single AZ only (`AvailabilityZones` has 1 entry) | **CONFIG_GAP** | Step 7 |65| `MaxSize == DesiredCapacity` (no scale-out headroom) | **CONFIG_GAP** | Step 8 |66| All dimensions pass | **OK** | Step 9 |6768See the ordered steps below for edge cases. Deep ASG lifecycle internals69(health-check evaluation pipeline, Spot rebalance timing, AZ rebalancing) are70in the [Deep reference](#deep-reference-auto-scaling-internals) section.7172## Pre-flight: ASG metadata gate (run before classification)7374Before evaluating the ASG configuration, classify the ASG's lifecycle state75and launch source. Several attributes short-circuit the audit —76misclassifying them produces false positives.7778| Attribute | Value | Effect on audit |79|---|---|---|80| `LaunchConfigurationName` | set | **Legacy launch configuration.** Immediately MISCONFIGURED (Step 1). LCs are deprecated (no new creation since Dec 2023), cannot enforce IMDSv2, and are incompatible with MixedInstancesPolicy. |81| `LaunchTemplate` | set | Proceed with full audit. This is the modern path. |82| `MixedInstancesPolicy` | set | The ASG uses MIP — evaluate instance-type diversification (Step 5). MIP overrides the top-level `LaunchTemplate`. |83| `SuspendedProcesses` | includes `HealthCheck` | **Suspended health checks.** The ASG will not replace unhealthy instances. Flag as operational risk — but classify the rest of the config normally. |84| `SuspendedProcesses` | includes `Launch` / `Terminate` | **Scaling is frozen.** The ASG cannot launch or terminate. Flag as operational risk. |8586**If the ASG configuration is malformed** (missing required fields like87`MinSize`, `MaxSize`, `HealthCheckType`), output:8889```text90ASG: <name>91VERDICT: ERROR92REASON: ASG configuration is missing required fields — cannot classify.93REMEDIATION: Retrieve the canonical config with94 aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names <name> --output json95 and re-audit.96```9798## Process — Classification logic (apply in order, aggregate worst)99100### Step 0: Expert knowledge — non-obvious ASG behaviors that change classification101102Deep dive moved to [references/advanced-patterns.md](references/advanced-patterns.md)103(Step 0: non-obvious ASG behaviors) — load before classifying edge-case ASGs.104105### Step 1: Launch template / configuration health106107Evaluate the launch source:108109- **MISCONFIGURED** if `LaunchConfigurationName` is set. Launch configurations110 are deprecated (no new creation since Dec 2023), cannot enforce IMDSv2, and111 are incompatible with MixedInstancesPolicy. This is a tech-debt dead end.112113- **CONFIG_GAP** if `LaunchTemplate` is set but `MetadataOptions.HttpTokens`114 is not `"required"`. IMDSv2 is not enforced — the instance metadata service115 is accessible via IMDSv1, which is vulnerable to SSRF attacks. An attacker116 who can make the instance call `169.254.169.254` can steal IAM instance117 profile credentials.118119- **OK** for this dimension if `LaunchTemplate` is set with120 `HttpTokens: "required"`.121122### Step 2: Capacity configuration123124Evaluate the min/max/desired bounds:125126- **MISCONFIGURED** if `DesiredCapacity > MaxSize` or127 `DesiredCapacity < MinSize`. The ASG will immediately launch or terminate128 instances to reach desired, but the desired value is logically inconsistent129 with the bounds. `describe-auto-scaling-groups` may show the desired value130 the user set, but the ASG corrects it silently — relying on silent131 correction is a production hazard.132133- **CONFIG_GAP** if `MinSize` is 0 for a production ASG. With MinSize=0, the134 ASG can scale to zero — the first scale-out has a cold start (AMI fetch +135 userdata + ELB registration: 3-5 minutes). For production workloads,136 MinSize >= 2 (one per AZ minimum) maintains baseline capacity.137138### Step 3: ELB health check integrity139140Evaluate the ELB health check wiring:141142- **MISCONFIGURED** if `HealthCheckType` includes `"ELB"` AND both143 `TargetGroupARNs` and `LoadBalancerNames` are empty or missing. No ELB is144 attached to report health — instances are treated as Unhealthy from launch,145 creating an infinite replacement loop. This is the most costly silent146 misconfiguration in Auto Scaling.147148- **CONFIG_GAP** if `HealthCheckType` includes `"ELB"` AND149 `HealthCheckGracePeriod < 60`. ELB target registration alone takes 30-60150 seconds. A grace period under 60 seconds gives the application near-zero151 time to boot and register before being evaluated — healthy instances get152 terminated prematurely.153154### Step 4: Health check type appropriateness155156Evaluate whether the health check type matches the traffic architecture:157158- **CONFIG_GAP** if `HealthCheckType` is `"EC2"` (or does not include ELB) AND159 (`TargetGroupARNs` is non-empty OR `LoadBalancerNames` is non-empty). An ELB160 is attached but the ASG only checks EC2 status checks — a hung application161 (process alive but not serving) is not detected. Use `HealthCheckType: ELB`162 or `"ELB,EC2"` for ASGs that front traffic via a load balancer.163164### Step 5: Mixed-instances policy evaluation165166Evaluate Spot diversification and allocation:167168- **MISCONFIGURED** if `MixedInstancesPolicy` exists AND the `Overrides` list169 has exactly 1 instance type AND Spot allocation is in use170 (`OnDemandPercentageAboveBaseCapacity < 100`). A single Spot instance type171 means the next Spot interruption affects 100% of Spot capacity. Diversify172 across 3+ instance types to survive pool-level interruptions.173174- **CONFIG_GAP** if no `MixedInstancesPolicy` exists AND the ASG uses a175 `LaunchTemplate` (not LC). MIP provides instance-type flexibility, Spot176 cost optimization, and AZ-aware allocation — all unavailable with a bare177 launch template. This is a recommended-practice gap, not an active failure.178179### Step 6: Capacity rebalance (Spot)180181- **CONFIG_GAP** if Spot allocation is in use182 (`OnDemandPercentageAboveBaseCapacity < 100` within a `MixedInstancesPolicy`)183 AND `CapacityRebalance.Enabled` is not `true`. Without Capacity Rebalance,184 the ASG only reacts after a Spot instance is terminated — it does not185 proactively launch a replacement on the rebalance recommendation. This186 creates a capacity gap during the replacement window.187188### Step 7: AZ diversity189190- **CONFIG_GAP** if `AvailabilityZones` has exactly 1 entry (or191 `VPCZoneIdentifier` references subnets in a single AZ). A single-AZ ASG has192 no resilience — an AZ outage takes down the entire fleet. Minimum 2 AZs for193 production; 3+ for high availability.194195### Step 8: Scale-out headroom196197- **CONFIG_GAP** if `MaxSize == DesiredCapacity`. The ASG can only scale in,198 never out. If traffic spikes, there is zero elasticity. This may be199 intentional for fixed-size groups, but for auto-scaling workloads it defeats200 the purpose. Ensure `MaxSize > DesiredCapacity` for a meaningful scale-out201 margin.202203### Step 9: Aggregation — worst finding wins204205The final verdict is the **maximum severity** across all findings, where206MISCONFIGURED > CONFIG_GAP > OK:207208```text209verdict = max(all_finding_severities)210```211212If no findings (all dimensions pass), the verdict is **OK**.213214## Output format (per ASG)215216```text217ASG: <name>218VERDICT: MISCONFIGURED | CONFIG_GAP | OK219REASON: <1-2 sentences citing the worst finding and its step number>220FINDINGS:221 - [MISCONFIGURED] <finding description (Step N)>222 - [CONFIG_GAP] <finding description (Step N)>223 - [OK] <dimension that passed>224REMEDIATION: <specific action per finding, or "None required" if OK>225```226227### Worked example — Spot single instance type228229```text230ASG: prod-spot-asg231VERDICT: MISCONFIGURED232REASON: MixedInstancesPolicy has 1 instance type (c5.large) with Spot233allocation (OnDemandPercentageAboveBaseCapacity=0) — a single Spot interruption234affects 100% of capacity (Step 5). CapacityRebalance is also disabled,235compounding the risk.236FINDINGS:237 - [MISCONFIGURED] Single Spot instance type (c5.large) with 0% On-Demand —238 no diversification against pool-level interruption (Step 5)239 - [CONFIG_GAP] CapacityRebalance.Enabled is false on a Spot-backed ASG —240 no proactive replacement on rebalance recommendation (Step 6)241 - [OK] Launch template with IMDSv2 required (Step 1)242REMEDIATION:243 1. Add 2+ instance types to Overrides (e.g., c5.large, c5a.large, m5.large)244 to diversify Spot pools.245 2. Set SpotAllocationStrategy to capacity-optimized to minimize246 interruptions.247 3. Enable CapacityRebalance:248 aws autoscaling create-or-update-tags --tags249 Key=capacity-rebalance,Value=true,...250 (or update via create-auto-scaling-group / update-auto-scaling-group251 with --capacity-rebalance)252```253254## Anti-Patterns — NEVER255256- NEVER classify `HealthCheckType: ELB` with no target group as anything other257 than MISCONFIGURED. Without an attached ELB, no health data is returned —258 every instance is Unhealthy from launch, creating an infinite replacement259 loop. This is not "suboptimal" — it is actively burning compute budget.260261- NEVER treat a launch configuration as equivalent to a launch template. LCs262 are deprecated, cannot enforce IMDSv2, and are incompatible with263 MixedInstancesPolicy. Any ASG using `LaunchConfigurationName` is locked out264 of modern EC2 features.265266- NEVER assume `HealthCheckGracePeriod` is measured from ELB registration. It267 is measured from instance **launch**. ELB registration takes 30-60s — a268 60s grace period gives the app near-zero warmup time. Treat < 60s with ELB269 checks as a CONFIG_GAP.270271- NEVER classify a single Spot instance type in a MixedInstancesPolicy as272 CONFIG_GAP. With Spot allocation (`OnDemandPercentageAboveBaseCapacity <273 100`), a single instance type means one interruption event affects 100% of274 capacity. This is MISCONFIGURED — the ASG will lose all Spot capacity on275 the next pool drain.276277- NEVER assume `HealthCheckType: EC2` detects application failure. EC2 status278 checks verify hypervisor-level health only. A hung application (process279 alive, port open, not serving requests) passes EC2 checks. If the ASG has280 a target group attached, the health check type should include ELB.281282- NEVER treat `OnDemandPercentageAboveBaseCapacity` as the total On-Demand283 percentage. It applies **above** `OnDemandBaseCapacity`. Base=2, Percent=50284 means the first 2 instances are On-Demand, then 50% of the remainder. The285 effective On-Demand ratio depends on DesiredCapacity.286287- NEVER set `SpotAllocationStrategy: capacity-optimized` and also set288 `SpotInstancePools`. `SpotInstancePools` only applies to `lowest-price`.289 With `capacity-optimized`, `SpotInstancePools` is dead configuration — it290 has no effect. Do not rely on it for diversification.291292- NEVER assume `$Latest` launch template version is safe for production. When293 the template is updated, `$Latest` immediately redirects. New instances use294 the new version while old instances keep theirs — fleet split. If the new295 version is broken, new instances fail and cycle infinitely. Pin a specific296 version number for production ASGs.297298- NEVER assume an ASG with `MaxSize == DesiredCapacity` can scale. It can only299 scale in. For auto-scaling workloads, ensure `MaxSize > DesiredCapacity`.300 This is CONFIG_GAP, not MISCONFIGURED — the ASG works, it just has no301 scale-out elasticity.302303- NEVER assume Standby instances free up capacity. Standby instances count304 against `MaxSize` but not `DesiredCapacity`. If MaxSize is tight, Standby305 instances block scale-out. Check Standby count before scaling operations.306307- NEVER modify an ASG's launch template without considering the instance308 refresh. Changing `$Latest` or pinning a new version does not automatically309 update existing instances — they keep their old version until replaced. Use310 `aws autoscaling start-instance-refresh` to roll out the change safely.311312- NEVER ignore `SuspendedProcesses`. An ASG with `HealthCheck` suspended will313 not replace unhealthy instances. An ASG with `Launch` or `Terminate`314 suspended cannot scale at all. Always check suspended processes before315 classifying capacity or health behavior.316317## Pre-flight safety checks (run before any remediation CLI)318319- **MANDATORY CONFIRMATION GATE.** Before any state-changing operation320 (UpdateAutoScalingGroup, StartInstanceRefresh, PutScalingPolicy,321 DetachLoadBalancerTargetGroups), the auditor MUST emit:322 `CONFIRM: About to <action> on ASG <name> in account <account>. This323 affects <consequence>. Proceed? (yes/no)`324325- **Snapshot the current ASG config for rollback:**326 `aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names <name> --output json > /tmp/<name>-backup-$(date +%s).json`327 BEFORE any modification. ASG configs are not versioned — there is no undo328 without a backup.329330- **Instance refresh safety.** Before starting an instance refresh to roll out331 a new launch template version, verify: (1) `MinHealthyPercentage` is set332 (default 90 — too high for small ASGs); (2) the new template version has333 been tested on a canary instance or non-prod ASG; (3) the ASG's health334 check grace period is long enough for the new AMI/userdata to complete335 boot. A failed instance refresh can take down the entire fleet.336337- **Capacity bounds check.** Before changing MinSize/MaxSize/DesiredCapacity,338 verify the new values are internally consistent (MinSize <= DesiredCapacity339 <= MaxSize) and that the account has sufficient On-Demand or Spot capacity340 in the target AZs. Use341 `aws service-quotas get-service-quota --service-code autoscaling --quota-code L-...`342 to check ASG resource limits.343344- **Spot allocation warning.** Before increasing Spot percentage or adding345 instance types, check346 `aws ec2 describe-spot-price-history` for recent price stability in the347 target AZs. A pool that was stable yesterday may be under pressure today.348349## Remediation guidance350351### For MISCONFIGURED — ELB health check with no target group (Step 3)3523531. Attach the target group:354 `aws autoscaling attach-load-balancer-target-groups --auto-scaling-group-name <name> --target-group-arns <arn>`3552. Verify the target group has a configured health check:356 `aws elbv2 describe-target-groups --target-group-arns <arn>`357 The health check path, interval, and healthy threshold must match the358 application's boot time.3593. If the ASG should NOT use ELB health checks (e.g., background workers),360 switch: `aws autoscaling update-auto-scaling-group --auto-scaling-group-name <name> --health-check-type EC2`361362### For MISCONFIGURED — legacy launch configuration (Step 1)3633641. Create a launch template from the launch configuration:365 `aws ec2 create-launch-template --launch-template-name <name> --launch-template-data file://template.json`3662. Update the ASG to use the template:367 `aws autoscaling update-auto-scaling-group --auto-scaling-group-name <name> --launch-template LaunchTemplateId=<id>,Version=1`3683. Start an instance refresh to roll existing instances to the new template:369 `aws autoscaling start-instance-refresh --auto-scaling-group-name <name>`370371### For MISCONFIGURED — single Spot instance type (Step 5)3723731. Add 2+ instance types to the MIP Overrides. Choose types with similar374 vCPU/memory (e.g., c5.large, c5a.large, m5.large).3752. Set `SpotAllocationStrategy: capacity-optimized` to minimize interruptions.3763. Enable CapacityRebalance:377 `aws autoscaling update-auto-scaling-group --auto-scaling-group-name <name> --capacity-rebalance`378379### For CONFIG_GAP — IMDSv2 not required (Step 1)3803811. Update the launch template with a new version enforcing IMDSv2:382 `aws ec2 create-launch-template-version --launch-template-id <id> --launch-template-data '{"MetadataOptions":{"HttpTokens":"required"}}'`3832. Update the ASG to use the new version:384 `aws autoscaling update-auto-scaling-group --auto-scaling-group-name <name> --launch-template LaunchTemplateId=<id>,Version=<n>`3853. Start an instance refresh to enforce on existing instances.386387### For CONFIG_GAP — short grace period (Step 3)3883891. Increase `HealthCheckGracePeriod` to at least 300 seconds:390 `aws autoscaling update-auto-scaling-group --auto-scaling-group-name <name> --health-check-grace-period 300`391392### For CONFIG_GAP — EC2 health check behind ELB (Step 4)3933941. Switch to ELB health checks:395 `aws autoscaling update-auto-scaling-group --auto-scaling-group-name <name> --health-check-type ELB`3962. Verify the target group health check is configured correctly (path, port,397 interval, healthy threshold).398399### For OK4004011. No remediation required for the current posture.4022. Recommend enabling Instance Refresh warmup checks if not already configured.4033. Recommend setting `NewInstancesProtectedFromScaleIn: true` for stateful404 workloads to prevent scale-in from terminating new instances before they405 receive traffic.406407## Deep reference: Auto Scaling internals408409Internals moved to [references/advanced-patterns.md](references/advanced-patterns.md)410(health-check lifecycle, Spot rebalance timing, OnDemand/Spot math, AZ rebalancing) — load on demand.411412## Recent AWS features (2024-2026)413414Feature notes moved to [references/advanced-patterns.md](references/advanced-patterns.md).415Load when deciding whether a recent feature changes the audit.416417## References (load on demand)418419- [references/advanced-patterns.md](references/advanced-patterns.md) — Step-0 expert deep dive, Auto Scaling internals (health-check lifecycle, Spot rebalancing, capacity math, AZ rebalancing), recent AWS features420421## Domain422423AWS CloudOps / Compute Elasticity & Auto Scaling Health.424425## AWS documentation426427- **Amazon EC2 Auto Scaling User Guide** — https://docs.aws.amazon.com/autoscaling/ec2/userguide/what-is-amazon-ec2-auto-scaling.html428- **Auto Scaling API Reference** — https://docs.aws.amazon.com/autoscaling/ec2/APIReference/429- **Auto Scaling Security** — https://docs.aws.amazon.com/autoscaling/ec2/userguide/security.html430- **Auto Scaling CLI Reference** — https://docs.aws.amazon.com/cli/latest/reference/autoscaling/431- **Blog: Instance maintenance policies** — https://aws.amazon.com/blogs/compute/proactively-manage-instance-maintenance-with-amazon-ec2-auto-scaling-instance-maintenance-policy/