SAP-C03 Operational Automation and Resilience: Auto Scaling, Self-Healing, Safe Remediation and Runbooks
Operational automation for SAP-C03 is the design of systems that watch their own health and capacity, respond to events without a person, scale on metrics, forecasts and schedules, replace failed parts automatically, and apply fixes and patches under safety limits so that one bad change cannot take everything down. This lesson covers the five skills of Task 5.4: health monitoring with CloudWatch alarms, EventBridge, AWS Health and Service Quotas, plus capacity planning with reservations; controlled remediation with circuit breakers, bulkheads, rate limits and retries with backoff and jitter; target tracking, step, predictive and scheduled scaling with warm pools; failure recovery through Auto Scaling health checks, Amazon ECS restarts and replacement, and Lambda retry policies; and automated runbooks for incidents and patching.
On this page10 sections
- Health monitoring and automated operational responses
- Capacity planning with Service Quotas and capacity reservations
- Retries with exponential backoff, jitter and idempotency
- Circuit breakers and bulkheads
- Controlled remediation with rate limits and error thresholds
- Dynamic scaling: target tracking and step scaling
- Predictive scaling, scheduled actions and warm pools
- Automated failure recovery for EC2 Auto Scaling and Amazon ECS
- Lambda retry policies and failure destinations
- Automated runbooks, incident response and patching
- Route CloudWatch alarm and AWS Health events through EventBridge to Systems Manager Automation, including one organization-wide Health feed through a delegated administrator.
- Plan capacity with Service Quotas (SERVICE_QUOTA() alarms, request templates, per-Region DR quotas) and On-Demand Capacity Reservations, and tell them apart from Savings Plans.
- Design controlled remediation with circuit breakers, bulkheads, rate-controlled automations, Distributed Map failure thresholds and EventBridge API destination rate limits.
- Configure retries with exponential backoff, jitter and idempotency in Step Functions and the AWS SDKs.
- Combine target tracking, step, predictive and scheduled scaling and warm pools, knowing how multiple policies, warmup and maximum capacity behave.
- Design automated recovery with Auto Scaling health check types, instance maintenance policies, lifecycle hooks, ECS restart policies and health checks, and Lambda failure handling per invocation model.
- Build event-driven runbooks with approvals, track issues in OpsCenter, and automate patching across an organization and inside Auto Scaling groups.
Health monitoring and automated operational responses
Health monitoring becomes an operational response when a signal (a CloudWatch alarm, an AWS Health event or a service event) reaches Amazon EventBridge and a rule starts automation such as an AWS Systems Manager Automation runbook. The architect's job is to pick the signal that actually carries the information, and the response that actually fixes the problem.
CloudWatch alarms and EventBridge
Every CloudWatch alarm state change is published to EventBridge as an event. A rule that matches a change to ALARM can target an SNS topic (people), a Lambda function, a Step Functions state machine, or a Systems Manager Automation runbook (machines). Alarm actions on the alarm itself are narrower: notify through SNS, invoke a Lambda function, run an EC2 action (stop, terminate, reboot, recover), drive Auto Scaling, or create an OpsItem or incident. None of them starts a Systems Manager Automation runbook directly; that path goes through EventBridge. Composite alarms combine several alarms so that one page represents one real impairment; designing those belongs to the observability task, but the alarms you build here (for example on quota usage) often feed them.
AWS Health events
AWS Health reports AWS-side events that affect your own resources: issues, account notifications and scheduled changes such as planned maintenance and instance retirement. Health sends these events to EventBridge (source aws.health), so one rule on the scheduledChange category covers EC2, RDS, ElastiCache, Direct Connect and many other services without polling. Other sources carry different data: Trusted Advisor reports best-practice check results, CloudTrail records API calls, and AWS Config evaluates resource configuration, none of which announce AWS maintenance.
A common automation is instance retirement. When AWS schedules an EBS-backed instance for retirement because its host is degraded, the Health event (for example AWS_EC2_PERSISTENT_INSTANCE_RETIREMENT_SCHEDULED) can start the AWS-owned AWS-RestartEC2Instance runbook with the instance ID from the event. A stop and start places an EBS-backed instance on new hardware; an operating-system reboot does not, because the instance stays on the same host. A CloudWatch recover action is different again: it reacts after a system status check has already failed.
One Health feed for an organization
By default an EventBridge rule in an account sees only that account's Health events. With AWS Health organizational view turned on from the management account, the management account, or an account registered as a delegated administrator for AWS Health, receives a single feed of Health events from every account in the organization. Rules written in that operations account then cover all accounts with nothing deployed in member accounts, which is the difference from forwarding rules pushed to each account with StackSets.
Capacity planning with Service Quotas and capacity reservations
Service Quotas is the capacity-planning control for account limits: quotas apply per account and per Region, and the service lets you monitor usage against them, request increases, and pre-request increases for new accounts. A scale-out or failover that hits a quota fails just as surely as one that lacks hardware.
Alarming on quota utilization
Many quotas publish usage to the AWS/Usage CloudWatch namespace (for example the vCPU ResourceCount for Running On-Demand Standard instances). CloudWatch metric math has a SERVICE_QUOTA() function that returns the current applied quota for a usage metric, so an expression such as m1/SERVICE_QUOTA(m1)*100 gives a utilization percentage. An alarm on that expression keeps working after every quota increase, while a static threshold computed from today's quota becomes wrong the moment the quota changes. Because it is an ordinary CloudWatch alarm, it can feed a composite alarm or an EventBridge rule.
Quota request templates and automatic management
- Quota request templates: in an organization with all features turned on, you list up to 10 quota values in a template and associate it with the organization. Service Quotas then submits those increase requests automatically for every new account that is created, so accounts start with the quotas they need (supported in commercial Regions that are not opt-in).
- Automatic Management: Service Quotas watches usage and, in Notify only mode, alerts when usage approaches a quota (at 80% and 95% utilization); in Notify and auto-adjust mode it also requests increases. Notices arrive through AWS Health, EventBridge, email or chat. It reacts to usage that already exists, so it does not give a new account raised quotas on day one.
Quotas in disaster recovery
Because increases are per Region, a recovery Region where the same functions or instances sit idle usually still has default quotas. A Lambda function failing over to such a Region is throttled at the Regional concurrency quota; reserved and provisioned concurrency are both allocated from that quota and cannot raise it. Request the same increases in the recovery Region in advance, and make quota parity part of DR readiness checks.
Capacity reservations versus pricing commitments
Only a capacity reservation guarantees that instances can launch in a specific Availability Zone; quotas are permissions and Savings Plans are pricing commitments. Many capacity-planning scenarios are decided by keeping those three apart.
| Mechanism | Reserves capacity in an AZ? | What it actually does |
|---|---|---|
| Service Quotas increase | No | Allows more usage; launches can still fail with insufficient capacity |
| Savings Plans (Compute or EC2 Instance) | No | Discounts usage in exchange for an hourly spend commitment; Compute Savings Plans follow you across families, sizes and Regions |
| Regional Reserved Instances | No | Billing discount for an instance family in a Region |
| Zonal Reserved Instances | Yes | Discount plus capacity in one AZ, locked to the instance type for the term |
| On-Demand Capacity Reservations | Yes | Capacity in one AZ for as long as you keep them, no term; billed at On-Demand rates whether used or not |
Two facts combine in cost questions. Capacity Reservations are billed at the On-Demand rate, but Savings Plans and regional Reserved Instances apply their discount to Capacity Reservations. So capacity that must be guaranteed for a long time, while the instance family may change, is best met with On-Demand Capacity Reservations covered by a Compute Savings Plan; a zonal Standard RI would also reserve capacity but ties the commitment to one instance type. For a short known peak (a sale, a launch), create reservations for just that period and release them afterwards. A scheduled action or a higher maximum size only changes when the launch is attempted, not whether capacity exists.
Open versus targeted reservations
A reservation with open eligibility is used automatically by any matching instance in the account. A reservation with targeted eligibility accepts only instances whose launch specifies it, either by reservation ID or through a capacity reservation resource group that contains it. An Auto Scaling group therefore uses targeted reservations only if its launch template's capacity reservation specification targets the reservation or the resource group; otherwise the reservations sit unused while the group launches ordinary On-Demand instances. Switching the reservations to open would fix utilization but lets other teams' matching instances consume the capacity, and an open preference in the launch template matches only open reservations.
Retries with exponential backoff, jitter and idempotency
A safe retry waits longer after each failure (exponential backoff), randomizes each wait (jitter), stops after a capped delay and number of attempts, and is only repeated for operations that are idempotent. Each part prevents a different failure.
- Backoff reduces the load each client adds while a dependency is struggling.
- Jitter stops clients that failed at the same moment from retrying at the same moment. Without it, thousands of clients on a fixed or purely exponential schedule retry in synchronized waves, and a recovering service is knocked over again. Fixed intervals, immediate retries and backoff without jitter all keep the waves.
- Caps on the maximum delay and the number of attempts keep the behaviour bounded.
- Idempotency makes a repeated request harmless. A retry can repeat a write whose first attempt succeeded but whose response was lost; a unique request ID enforced with a conditional write (or an idempotency token on the API) rejects the duplicate. Fewer or no retries trade duplicates for lost writes, which is not a fix.
Step Functions retriers
A Task state's Retry field lists retriers with ErrorEquals, IntervalSeconds (first wait), BackoffRate (multiplier per attempt), MaxAttempts, MaxDelaySeconds (a cap on any single wait) and JitterStrategy. Setting JitterStrategy to FULL randomizes each delay between zero and the computed backoff, which breaks up waves when many executions fail together; NONE is the default. Changing the backoff rate or the attempt count, or looping through a fixed Wait state, keeps every execution on the same schedule.
AWS SDK retry modes
| Mode | Behaviour |
|---|---|
| legacy | Older per-SDK behaviour; kept for compatibility |
| standard | Exponential backoff with jitter, a default of 3 attempts, and a retry quota that limits retries during wide outages |
| adaptive | Everything in standard plus client-side rate limiting: a throttled client slows its own request rate instead of sending at full rate between retries |
Raising the attempt count in standard mode amplifies load during throttling; adaptive mode is the setting that makes each client back off its sending rate.
Circuit breakers and bulkheads
A circuit breaker stops calls to a failing dependency for a cool-down period and serves a fallback instead, while a bulkhead isolates resources so that one failing dependency or tenant cannot exhaust what others need. Retries handle brief faults; these patterns handle long ones.
Circuit breaker states
- Closed: calls flow normally and failures are counted.
- Open: after repeated failures, callers skip the dependency and return a fallback (a cached or default value, or a queued request) until the open period ends.
- Half-open: after the open period, one trial request is allowed. If it succeeds the circuit closes; if it fails the circuit reopens.
Without a half-open state, every waiting caller sends traffic the instant the open period ends, a fragile dependency fails again, and the circuit flaps. A longer open period or jittered retries still release full traffic at once.
Shared state in DynamoDB
In serverless designs (Step Functions and Lambda) the breaker state must be shared by every caller, and AWS Prescriptive Guidance uses a DynamoDB table for it: callers read the circuit item before calling, and a failure counter opens it. Two implementation details matter:
- Expiry must be checked on read. DynamoDB TTL deletes expired items in the background, typically within a few days, and reads return expired items until then. A breaker that treats "item exists" as "circuit open" can stay open for hours. Compare the expiry attribute with the current time on every read (or use a filter expression) and treat an expired item as closed.
- Exactly one probe in half-open. A conditional write, such as setting a probe owner only if none exists, lets exactly one caller win the right to send the trial request while the rest keep using the fallback.
Queues, lower concurrency and more retries only slow calls down; they do not stop them or provide a fallback.
Bulkheads
The symptom of a missing bulkhead is a shared resource exhausted by one slow or noisy party. Typical bulkheads on AWS:
| Shared resource | Bulkhead |
|---|---|
| One connection pool for several downstream services | A fixed-size pool with its own short timeout per dependency; a bigger shared pool or retries keep one compartment |
| The account's Regional Lambda concurrency | Reserved concurrency on the critical function guarantees it a share no other function can use (and also caps it) |
| A queue-driven function competing for that concurrency | Maximum concurrency on the SQS event source mapping caps how many invocations the queue drives; extra messages wait in the queue. Reserved concurrency on the consumer also caps it, but by throttling, which returns messages for retry and can push them to a dead-letter queue |
| One SQS standard queue shared by many tenants | SQS fair queues: producers set the tenant ID as MessageGroupId on a standard queue; SQS detects a tenant with a disproportionate share of in-flight messages and delivers other tenants' messages first, with no consumer change and no throughput limit |
Fair queues are not FIFO queues. On a FIFO queue the same attribute means strict ordering per group, FIFO throughput quotas apply to the queue, and an existing standard queue cannot be converted to FIFO.
Controlled remediation with rate limits and error thresholds
Controlled remediation applies a change to many resources in limited batches and stops automatically when too many changes fail, so that a faulty fix damages a few resources instead of all of them. AWS offers this control in several services.
Systems Manager rate control
A rate-controlled automation runs a runbook against targets (tags, resource groups or parameter values) with two safety settings:
MaxConcurrency: how many targets run at once, as a number or a percentage of the targets.MaxErrors: how many failures are tolerated before Automation stops starting new targets, also a number or a percentage. With an absolute value of N, it stops when error N+1 arrives; invocations already running may finish.
MaxErrors and MaxConcurrency each accept either an absolute count or a percentage of the targets, and on a large fleet the two give very different stop points. A simple execution that lists every instance ID has no batching or error threshold. Run Command and maintenance window tasks use the same two settings. Running the same control across many accounts and Regions is covered in the multi-account operations lesson.
Step Functions Distributed Map
For a large item list (for example a large item list stored in S3), a Map state in Distributed mode runs each item as a child workflow execution. MaxConcurrency limits how many run in parallel, and ToleratedFailurePercentage or ToleratedFailureCount sets how many items may fail before the whole Map Run fails, which is the stop switch. Inline mode runs inside the parent execution, is limited to 40 concurrent iterations and has no tolerated-failure setting; per-item retries never stop the run.
EventBridge API destinations
When remediation or ticketing calls a third-party HTTP API with a request ceiling, an API destination enforces it without code: you set an invocation rate limit per second, and events above it are delayed and delivered later within the target's retry policy (by default up to 24 hours and 185 attempts). EventBridge retries 429 and 5xx responses, and a dead-letter queue keeps events that still cannot be delivered. Retries without a rate limit break the ceiling, and Lambda concurrency limits cap parallel calls, not requests per second.
Dynamic scaling: target tracking and step scaling
Target tracking scaling keeps a metric (average CPU, request count per target, or a custom metric) near a target value by creating and managing its own CloudWatch alarms and adjusting capacity proportionally. It is the default choice for metric-based scaling of Auto Scaling groups.
How target tracking behaves
- Several policies favour availability. When a group has more than one target tracking policy, it scales out if any policy calls for more capacity (the largest request wins) and scales in only when every policy is ready to scale in. Policies have no creation-order priority.
- Never edit the managed alarms. The alarms that target tracking creates belong to the policy; edits are overwritten or break it.
- Default instance warmup. New instances often run hot while initializing (compiling caches, loading data). Target tracking aggregates the metric over in-service instances, so that startup spike looks like load and triggers more scale-outs. A default instance warmup on the group keeps new instances' metrics out of the aggregate until the warmup ends; it is the setting AWS recommends for every group. The health check grace period is a different setting that only delays health checks.
- Scale-in protection. Termination policies choose which instance leaves (oldest, oldest launch template and so on). To keep a busy instance from being chosen at all, the workload sets instance scale-in protection on itself when a job starts and clears it when the job ends. Scale-in protection does not stop health-check replacement.
Custom scale-in with step scaling
When scale-in must be slower than scale-out (for example, only after the metric has stayed well below target for a set time, and one instance at a time), set DisableScaleIn on the target tracking policy so that it only adds capacity, and add a step scaling policy on your own CloudWatch alarm that removes capacity. A second target tracking policy at a lower target does not achieve this: it would also scale out whenever the metric passes its lower target. The group's default cooldown applies only to simple scaling policies, so it does not tune target tracking or step scaling.
Scaling ECS services and Lambda concurrency for performance, and choosing the metric for queue backlogs, are covered in the performance and scalability lessons.
Predictive scaling, scheduled actions and warm pools
Predictive scaling forecasts load from the metric history of an Auto Scaling group and launches capacity ahead of the forecast, scheduled actions set capacity at fixed times, and warm pools make a scale-out fast by keeping pre-initialized instances ready. Each answers a different question: recurring patterns, known times, or slow boots with unpredictable spikes.
Predictive scaling modes and limits
- Forecast only creates forecasts (visible in the console and as metrics) without changing capacity, so you can compare them with actual load before trusting them. Forecast and scale also launches capacity ahead of the forecast; a scheduling buffer controls how far ahead.
- By default predictive scaling honors the group's maximum size (
MaxCapacityBreachBehaviorHonorMaxCapacity). WithIncreaseMaxCapacityit may raise the maximum when the forecast exceeds it, limited byMaxCapacityBuffer, a percentage above the forecast capacity. That ties growth beyond the maximum to the forecast, which a fixed larger maximum or daily scheduled maximums do not. - Predictive scaling does not react to unexpected load, so AWS recommends keeping a dynamic policy such as target tracking alongside it; the group uses the higher of the two capacities.
Scheduled actions and time zones
A scheduled action sets minimum, maximum or desired capacity once or on a cron recurrence. The recurrence is evaluated in UTC unless the action has a time zone (an IANA name such as Europe/Berlin); with one, the cron expression is written in local time and follows daylight-saving changes automatically. A fixed UTC expression is right for only half the year in such zones. Use scheduled actions when a floor is required at a fixed time; a forecast does not guarantee one.
Warm pools
A warm pool holds instances that have already completed their slow first boot, so a scale-out only has to start them. Instances can wait in the Stopped state (you pay for volumes, not compute, usually the cost-effective choice), Hibernated (memory kept on the root volume) or Running (fastest, billed as running). An instance reuse policy can return instances to the pool on scale-in instead of terminating them.
Two details decide many designs:
- When an instance enters the warm pool, Auto Scaling does not wait for user data to finish before stopping or hibernating it, so long downloads or installs can be cut off. Add a launch lifecycle hook and have the script call
CompleteLifecycleActionwhen initialization finishes (or let the heartbeat timeout pass). - Warm pools need EBS root volumes and cannot be used in mixed instances groups that use Spot Instances or instance weighting.
Automated failure recovery for EC2 Auto Scaling and Amazon ECS
Automated failure recovery means a health signal marks a unit unhealthy and the platform replaces or restarts it, in a way that keeps enough healthy capacity and lets in-flight work finish. Auto Scaling groups and ECS each have several knobs for this.
Auto Scaling health check sources
| Health check type | Detects |
|---|---|
| EC2 (always on) | Instance status checks failing, or an instance that is not running |
| ELB | Load balancer target health checks failing |
| VPC Lattice | VPC Lattice target group health checks failing |
| EBS | Attached EBS volumes that are unreachable or impaired (Nitro-based instances) |
| Custom | Whatever your own tool decides, reported with SetInstanceHealth |
Types can be combined (for example EBS and ELB together). A TCP health check that only proves a listener accepts connections cannot see a hung disk, which is what the EBS type adds; an external monitoring tool can mark an instance Unhealthy through SetInstanceHealth without a load balancer. The health check grace period applies only to newly launched instances (it also covers VPC Lattice and container health checks); it adds no check and does nothing for a reboot later in the instance's life.
Replacing without losing capacity or work
- By default a health replacement terminates first, then launches. An instance maintenance policy with a minimum healthy percentage of 100 and a maximum above 100 makes the group launch the replacement and wait for it before terminating, so healthy capacity never drops below desired. It applies to health replacements, instance refresh, maximum instance lifetime and rebalancing, without raising steady-state capacity.
- Instance scale-in protection stops only scale-in, and Auto Scaling does not honour EC2 termination protection. A termination lifecycle hook applies to every termination by the group, including health replacement: the instance waits in
Terminating:Waitwhile it uploads a checkpoint or drains, then callsCompleteLifecycleAction(or the timeout passes). - Suspending
ReplaceUnhealthyorHealthCheckstops replacements for every instance, which is rarely acceptable as a fix for one planned activity.
Amazon ECS restart and replacement
| Mechanism | Triggered by | Result |
|---|---|---|
| Essential container (default) | The container exits | The whole task stops and the service scheduler replaces it |
| Container restart policy | The container exits | The ECS agent restarts that container inside the same task in seconds (essential or non-essential; Fargate, EC2 and ECS Anywhere); you can ignore chosen exit codes and set a restart attempt period, how long a container must run before it may be restarted again |
| Container health check | A command run inside the container fails repeatedly | An essential container reporting UNHEALTHY makes the task unhealthy, and the service replaces it |
| Load balancer health check | Target health checks fail | The service replaces the task (after the service's grace period) |
| Deployment circuit breaker | A deployment's tasks keep failing | The deployment stops and can roll back; it does not act outside deployments |
A process that hangs without exiting never triggers a restart policy; a health check (a liveness probe that checks the process is still doing work) is what detects it. Marking a sidecar non-essential stops it from taking down the task but leaves it dead.
Draining ECS container instances
With an Auto Scaling group capacity provider, managed termination protection only stops scale-in from removing instances that run tasks. Managed instance draining uses an ECS-managed lifecycle hook to put an instance into DRAINING before any group termination (scale-in, instance refresh, maximum instance lifetime, health replacement, Spot rebalancing and interruption), so tasks are rescheduled elsewhere first. The agent's Spot instance draining setting covers only Spot interruption notices, and a target group's deregistration delay does not move tasks.
Lambda retry policies and failure destinations
How Lambda retries a failure depends on how the function is invoked: asynchronous invocations, stream event source mappings and SQS event source mappings each have their own retry settings and their own place for failed events. Most mistakes come from applying one invocation model's setting to another.
| Invocation model | Retry behaviour and limits | Where failures go |
|---|---|---|
| Asynchronous (S3 notifications, SNS, EventBridge, async Invoke) | Lambda queues the event and retries up to 2 times by default (MaximumRetryAttempts 0–2); MaximumEventAgeInSeconds (60 seconds to 6 hours) discards events that are too old | On-failure destination (SQS, SNS, Lambda, EventBridge or S3, with the invocation record) or a function dead-letter queue (SQS or SNS only) |
| Stream event source mapping (Kinesis, DynamoDB Streams) | By default a failing batch is retried until it succeeds or the records expire, blocking that shard; BisectBatchOnFunctionError, MaximumRetryAttempts and MaximumRecordAgeInSeconds limit this | On-failure destination on the event source mapping (for example an SQS queue or SNS topic), which records what was discarded |
| SQS event source mapping | Lambda polls and invokes synchronously; a failed batch becomes visible again after the visibility timeout and is retried | A redrive policy on the source queue moves a message to the queue's dead-letter queue after maxReceiveCount receives |
Keeping good records and setting bad ones aside
- Streams: bisect batch on function error splits a failing batch in two on each error, so good records are processed and the bad one is isolated; a finite retry count or record age lets Lambda discard it and move on. Both are configuration only. Partial batch responses (
ReportBatchItemFailures) also work for streams but require function code that returns the failed sequence number. A higher parallelization factor adds concurrency per shard but keeps per-key ordering, so a poison record still blocks its key. - SQS: with
ReportBatchItemFailuresturned on, the function returns the IDs of failed messages, so successful messages in the batch are deleted and not processed again (which prevents duplicate side effects). Combine it with the queue's redrive policy; AWS recommends amaxReceiveCountof at least 5 and a visibility timeout of at least six times the function timeout. Bisect and maximum retry attempts are stream-only settings, and a function's async DLQ never sees event source mapping traffic.
Automated runbooks, incident response and patching
Automated runbooks turn an operational procedure (remediate, collect evidence, restart, patch, scale) into a Systems Manager Automation document or patch configuration that starts from an event or a schedule, with approvals and safety limits where a human must decide.
Starting runbooks from events
An EventBridge rule can target a Systems Manager Automation runbook directly. An input transformer maps fields from the event (such as the instance ID in an alarm or Health event) to the runbook's parameters, and EventBridge needs an IAM role it can assume to start the execution. This removes the human from routine, well-understood responses. An OpsItem with an associated runbook or an SNS notification still waits for a person, and an EC2 alarm action can only stop, terminate, reboot or recover.
Approvals and evidence
The aws:approve action pauses a runbook until a specified approver (IAM users, IAM roles or assumed-role sessions; a minimum number of approvals can be required) approves or rejects. Put it after steps that must happen immediately, such as collecting thread dumps and logs from every instance, and before disruptive steps such as a restart.
Tracking incidents
Systems Manager OpsCenter records operational issues as OpsItems, created from CloudWatch alarms (an alarm action) or EventBridge rules. It groups duplicates, shows the affected resources with their configuration and CloudTrail history, and lets an engineer run the associated runbook from the item. AWS Systems Manager Incident Manager is closed to new customers; existing customers keep it, but new accounts should use OpsCenter with alarms, runbooks and their own paging. Explorer only summarizes operational data, and the Health Dashboard reports AWS-side events.
AWS Config auto-remediation
An AWS Config rule can have an automatic remediation action, a Systems Manager Automation runbook that runs when a resource becomes noncompliant, with a configurable number of retry attempts and retry interval so that a transient failure does not leave the resource noncompliant. Rate-limited remediation of many resources is covered above.
Patching at scale
- Quick Setup patch policies define scan and install schedules, patch baselines (which classifications and severities, with approval delays) and reboot options once, and apply them to an organization, chosen OUs or accounts, and chosen Regions. New accounts in targeted OUs are covered automatically. Per-account maintenance windows deployed with StackSets work but cost more effort, and Amazon Inspector finds missing patches without installing them.
- Maintenance windows run
AWS-RunPatchBaselinetasks on a schedule with the same concurrency and error thresholds as other rate-controlled tasks. - Patching inside Auto Scaling groups: a reboot can fail ELB health checks, and the group replaces the instance from the old AMI. The grace period does not help (it covers only new launches).
AWS-RunPatchBaselineWithHooksruns a pre-install hook before installing, a post-install hook before the reboot and an on-exit hook after the reboot, so each instance can enter Standby before patching and exit it afterwards, while other instances are still replaced if they fail. - Immutable patching: patching in place leaves the AMI stale, so new launches start unpatched. An EC2 Image Builder pipeline can build a patched AMI on a schedule and, through launch template configurations in its distribution settings, set it in a new default launch template version. An instance refresh then replaces instances in batches while keeping its minimum healthy percentage in service, and auto rollback with a CloudWatch alarm specification returns to the previous configuration if the alarm fires.
Tip. Task 5.4 questions are multi-account or fleet-scale scenarios that describe a failure that already happened (a scale-out that hit a quota, a retry storm, a circuit that stayed open, a shard that stopped, instances replaced from an unpatched image) and then state several requirements at once, such as no custom code, no resources in member accounts, capacity never below a floor, or a hard request ceiling. Options are all real AWS settings from the same family, often differing in one value or one ordering: a number versus a percentage for an error threshold, Distributed versus Inline Map, an on-failure destination versus a dead-letter queue, forecast only versus forecast and scale, a restart policy versus a health check, approval before or after evidence collection. Expect to know which invocation model or scaling policy a setting belongs to, which mechanisms reserve capacity and which only discount or permit it, and which AWS services are closed to new customers.
- EventBridge is the hub: alarm state changes and AWS Health events reach rules that start Automation runbooks; organizational view plus a delegated administrator gives one Health feed for every account.
- A stop and start moves an EBS-backed instance to new hardware; a reboot does not.
- Quotas are per account and per Region: alarm on usage divided by SERVICE_QUOTA(), use quota request templates for new accounts, and raise DR Region quotas in advance.
- Only Capacity Reservations and zonal RIs reserve capacity; Savings Plans discount Capacity Reservations, and targeted reservations need the launch template to target them.
- Retries need backoff, jitter (Step Functions JitterStrategy FULL, SDK standard or adaptive mode), caps and idempotent writes; adaptive mode adds client-side rate limiting.
- A circuit breaker needs shared state, an expiry checked on read (TTL deletes late) and a half-open single probe; bulkheads isolate pools, Lambda concurrency and tenants (SQS fair queues).
- Safe remediation uses MaxConcurrency and MaxErrors, Distributed Map tolerated failures, and API destination invocation rate limits with a DLQ.
- Target tracking scales out if any policy asks and in only if all agree; use default instance warmup, scale-in protection, and DisableScaleIn plus step scaling for custom scale-in, never edited alarms.
- Predictive scaling: forecast only to evaluate, IncreaseMaxCapacity with MaxCapacityBuffer to exceed the maximum, keep target tracking alongside; scheduled actions take an IANA time zone; warm pools need a lifecycle hook for long user data.
- Recovery: combine health check types (ELB, EBS, custom SetInstanceHealth), launch-before-terminate maintenance policies and termination lifecycle hooks; ECS restart policies handle exits, health checks handle hangs; Lambda retry settings differ for async, stream and SQS invocations.
Frequently asked questions
How do I alarm on an AWS service quota so the alarm stays correct after quota increases?
Use CloudWatch metric math on the quota's usage metric in the AWS/Usage namespace: divide the usage metric by SERVICE_QUOTA() of the same metric and multiply by 100, then alarm on that percentage (for example above 80). SERVICE_QUOTA() returns the currently applied quota, so the alarm follows every increase, whereas a static threshold based on today's quota becomes wrong after the next increase.
Does a Savings Plan guarantee EC2 capacity?
No. A Savings Plan is a pricing commitment that discounts usage; it does not set capacity aside. Capacity in a specific Availability Zone is guaranteed only by On-Demand Capacity Reservations or zonal Reserved Instances. Savings Plans and regional Reserved Instances do apply their discount to Capacity Reservations, so reservations covered by a Compute Savings Plan give guaranteed capacity at a discounted rate without locking the commitment to one instance family.
What is the difference between exponential backoff and jitter?
Exponential backoff increases the wait after each failed attempt so that a struggling service receives less load, while jitter randomizes each wait so that many clients that failed at the same moment do not retry at the same moment. Backoff without jitter still produces synchronized retry waves when thousands of clients fail together. In AWS Step Functions, JitterStrategy FULL adds jitter to a retrier and MaxDelaySeconds caps the wait.
How do I build a circuit breaker for AWS Lambda or Step Functions?
Keep the circuit state in a shared store such as an Amazon DynamoDB table that every caller reads before calling the dependency. Repeated failures open the circuit, and while it is open callers return a fallback instead of calling. Store an expiry time and check it on every read, because DynamoDB TTL deletes expired items late. After the open period, use a conditional write so that exactly one caller sends a half-open trial request; success closes the circuit and failure reopens it.
Why does my Auto Scaling group keep scaling out when new instances start?
Target tracking aggregates its metric over in-service instances, so new instances that run at high CPU while they initialize look like extra load and trigger more scale-outs. Setting a default instance warmup on the group, roughly the time an instance needs to settle, keeps new instances' metrics out of the aggregate until the warmup ends. The health check grace period does not help, because it only delays health checks.
Can predictive scaling go above an Auto Scaling group's maximum size?
Only if you allow it. By default predictive scaling honors the maximum size. Setting MaxCapacityBreachBehavior to IncreaseMaxCapacity lets it raise the maximum when the forecast exceeds it, limited by MaxCapacityBuffer, a percentage above the forecast capacity. Predictive scaling does not react to unexpected load, so keep a target tracking policy on the group as well.
What is the difference between an Amazon ECS container restart policy and a container health check?
A container restart policy restarts a container inside the same task when the container exits, which recovers a crashed sidecar in seconds without replacing the task. A container health check runs a command inside the container; when an essential container reports UNHEALTHY, the task is marked unhealthy and the ECS service replaces it. A process that hangs without exiting never triggers a restart policy, so hangs need a health check.
Where do failed events go for AWS Lambda?
It depends on the invocation model. Asynchronous invocations can send failed events to an on-failure destination (SQS, SNS, Lambda, EventBridge or S3) or to a dead-letter queue (SQS or SNS only), after up to two retries and within a maximum event age. Kinesis and DynamoDB Streams event source mappings use an on-failure destination on the mapping, with bisect batch and maximum retry settings. SQS event source mappings rely on the source queue's redrive policy and dead-letter queue, plus ReportBatchItemFailures for partial batches.
Source
This lesson covers the "Operational Excellence and Automation" domain of the official SAP-C03 exam guide. Vendors revise their guides — check the source for the current version.
- AWS Certified Solutions Architect – Professional (SAP-C03) exam guide — Amazon Web Services
Sign up free to mark lessons complete, bookmark topics and track your exam readiness.