Sub topic 3
Operational Excellence: running and improving workloads
This chapter assumes you know core AWS services such as EC2, S3, IAM and CloudWatch. It also assumes you have seen how a multi-tier application is deployed. You should have read the framework overview, so you know what a pillar is and how questions and best practices fit under it.
What the pillar is for
The Operational Excellence pillar covers how you run workloads, how you get insight into their behavior, and how you improve the supporting processes over time. Its goal is to deliver business value by running and monitoring systems well. It does this by making change safe and routine, and by turning every incident into a lesson.
The pillar is mostly about people and process. A workload with good architecture can still fail often if deployments are manual, alerts are noisy, and nobody reviews incidents. The reverse also holds. A modest architecture with disciplined operations often beats a sophisticated one that nobody understands at 3 a.m.
Design principles
The framework lists these design principles for the pillar:
- Perform operations as code. Define infrastructure, deployments and runbooks in code, so they are repeatable, reviewable and testable. Human error drops when a script does the work.
- Make frequent, small, reversible changes. Small changes are easier to understand and to undo. A rollback of one small change is cheap. A rollback of a quarterly release is not.
- Refine operations procedures frequently. Runbooks and playbooks go stale. Schedule game days and review them.
- Anticipate failure. Run pre-mortems, which are exercises that ask "how could this fail?" before it does. Test your failure responses.
- Learn from all operational events and metrics. Share what you learn across teams. Look at near misses, not only outages.
- Use managed services. Each managed service you adopt removes operational work from your team. This links to the shared responsibility model, where AWS takes over more of the stack.
The four areas
The pillar groups its best practices into four areas: Organization, Prepare, Operate and Evolve. They form a loop, not a sequence.
Organization
Organization practices cover who decides what, and why. Teams need to understand business priorities, compliance requirements and the risks they may accept. The key idea is clear ownership. Every workload, process and alert should have an identified owner. When ownership is unclear, escalation is slow and improvements stall.
Typical practices include:
- Define priorities from the business, so teams know whether to favor speed, cost or stability.
- Assign owners and tag resources with them, for example with
ownerandenvironmenttags. - Agree on who may approve risky changes, and how teams escalate.
- Build a culture where raising problems is safe.
Prepare
Preparing means designing the workload so you can understand its state from the outside. This property is called observability. It also means getting ready for change and for failure.
- Design telemetry. Emit metrics, logs and traces. Amazon CloudWatch collects metrics and logs, and AWS X-Ray traces requests across services.
- Design for deployment. Use infrastructure as code, such as AWS CloudFormation or the AWS CDK, and automated pipelines such as AWS CodePipeline.
- Mitigate deployment risk. Use strategies like blue/green or canary deployments, and automated rollback.
- Check readiness. Before launch, confirm that runbooks exist, monitoring works, and the team can support the workload. Production readiness reviews are a common tool.
A good test of preparation: could an engineer who did not build the system find out why it is slow, using only dashboards and logs?
Operate
Operating means understanding workload health and responding to events. The pillar distinguishes between two kinds of signal:
- Workload health. For example, request latency, error rate and queue depth.
- Operations health. For example, deployment frequency, change failure rate and time to recover.
You should define key performance indicators (KPIs) tied to business outcomes, then alert on what needs human action. An alert that nobody acts on is noise, and noise trains people to ignore alerts.
Respond to events using runbooks and playbooks. A runbook is a documented procedure for a known task, such as restarting a service. A playbook guides investigation when the cause is unknown. Where possible, automate the response. AWS Systems Manager Automation can run runbooks as code, and Amazon EventBridge can trigger them from events.
The following command creates a CloudWatch alarm on server errors from an Application Load Balancer and notifies an SNS topic. Replace the load balancer dimension value and the topic ARN with your own.
aws cloudwatch put-metric-alarm \
--alarm-name orders-api-5xx \
--alarm-description "Target 5xx errors on orders-api" \
--namespace AWS/ApplicationELB \
--metric-name HTTPCode_Target_5XX_Count \
--dimensions Name=LoadBalancer,Value=app/orders-api/50dc6c495c0c9188 \
--statistic Sum \
--period 60 \
--evaluation-periods 5 \
--threshold 10 \
--comparison-operator GreaterThanOrEqualToThreshold \
--treat-missing-data notBreaching \
--alarm-actions arn:aws:sns:us-east-1:111122223333:ops-alertsThe alarm fires only if the sum reaches 10 in each of five consecutive one-minute periods. That choice avoids paging someone for a single bad minute. Setting --treat-missing-data notBreaching means a quiet period with no data does not raise a false alarm.
Evolve
Evolving means learning from operations and feeding that back into the other areas. The practices are:
- Learn from events. Hold a blameless post-incident review. Ask what in the system and process allowed the failure, not who caused it.
- Share findings. Put the lessons where other teams will find them.
- Look for trends. Review metrics weekly or monthly, since slow degradation is hard to see from day to day.
- Make improvements a work item. An action item that is not in the backlog tends not to happen.
Small, reversible changes in practice
The principle of small, reversible changes is easiest to follow with infrastructure as code and change previews. With CloudFormation you can create a change set and inspect it before anything is applied:
aws cloudformation deploy \
--template-file template.yaml \
--stack-name orders-api \
--no-execute-changesetThis command creates a change set and stops. You then review it in the console or with aws cloudformation describe-change-set, and run aws cloudformation execute-change-set when you are satisfied. Because the template lives in version control, a rollback is a revert of a commit followed by another deployment. If a stack update fails, CloudFormation rolls back by default.
The same idea applies to application releases. A canary deployment sends a small share of traffic to the new version first. If error rates rise, the pipeline stops and reverts. The cost of a mistake is limited to a small share of users.
Common errors
Reviewers see the same weaknesses in this pillar repeatedly:
| Weakness | Why it hurts | Better practice |
|---|---|---|
| Manual console changes | Changes are untracked and not repeatable | Infrastructure as code with peer review |
| Runbooks written once, never tested | They fail when needed | Rehearse them in game days |
| Alerts with no owner | Nobody responds | Tag owners and route alerts to them |
| Large, infrequent releases | Hard to diagnose and roll back | Small, frequent, automated releases |
| Post-incident reviews that assign blame | People hide information | Blameless reviews with tracked actions |
| Monitoring only infrastructure metrics | Misses user-visible problems | Add business and workload KPIs |
How reviewers ask about it
In a Well-Architected review, the questions in this pillar are grouped under Organization, Prepare, Operate and Evolve. A question such as "How do you reduce defects, ease remediation, and improve flow into production?" has a list of best practices beneath it. You mark which ones you follow. The count of best practices you do not follow determines whether the question is flagged as a high or medium risk. The review itself is covered in later chapters.
To answer honestly, collect evidence: pipeline configurations, a runbook, an incident review document. If you cannot point to one, the practice probably is not in place.
Exercise
A team deploys its application once a quarter by following a 40-step document and clicking through the AWS console. Deployments often cause outages that take hours to diagnose. Name two Operational Excellence design principles this team is not following and one concrete change for each.
Show answer
The team is not following "perform operations as code" and "make frequent, small, reversible changes". For the first, define the infrastructure and the deployment steps in CloudFormation or the AWS CDK and run them from a pipeline, replacing the manual 40-step document. For the second, release smaller changes much more often, using a canary or blue/green strategy with automated rollback, so that each release is easy to diagnose and revert.
Exercise
Your alarm on 5xx errors has fired 30 times this month, and no one took action on any of them. Which of the four areas does this point to, and what should you do?
Show answer
It points mainly to the Operate area, since alerts should signal events that need human action. Review the alarm's threshold and evaluation periods, raise them or remove the alarm if it is not actionable, and make sure it has a named owner and a runbook. Also record the change as an Evolve activity, so the lesson feeds back into practice.