Cloud Deployment Basics (AWS/GCP)

Chapter 11
Observability, Reliability and Incident Management

Diploma in DevOps
Cloud Deployment Basics (AWS/GCP)   •   Diploma

Observability, Reliability and Incident Management

Introduction

Modern cloud systems are distributed across virtual machines, containers, managed databases, queues, networks, regions, and third-party services. A failure may therefore appear first as a slow API, an increased queue depth, a database connection error, or an apparently healthy service returning incorrect results. Cloud deployment is not complete when software is released: it is complete when the service can be understood, operated, measured, and restored when conditions change.

This chapter introduces observability, reliability engineering, and incident management for AWS and Google Cloud environments. It focuses on practical use of logs, metrics, traces, dashboards, alerts, service-level indicators (SLIs), service-level objectives (SLOs), service-level agreements (SLAs), error budgets, resilience techniques, and blameless post-incident learning.

Learning Objectives

By the end of this chapter, you should be able to:

  • distinguish monitoring from observability;
  • design useful logs, metrics, traces, dashboards, and alerts;
  • calculate and interpret SLIs, SLOs, availability, latency, and error budgets;
  • select appropriate AWS and Google Cloud observability services;
  • apply resilience and incident-response practices;
  • participate in a structured, blameless post-incident review.

1. Monitoring and Observability

Monitoring is the collection and presentation of known signals about system behaviour. For example, a team may monitor CPU utilization, HTTP 5xx responses, or disk capacity. Monitoring answers questions that engineers have anticipated.

Observability is the ability to infer the internal state of a system from its externally available outputs. It is especially important in distributed systems, where failure modes are numerous and not all questions can be predicted in advance. A highly observable service provides rich, correlated evidence about what happened, where it happened, and who or what was affected.

The principal telemetry types are:

TelemetryMain purposeTypical examples
LogsDetailed event recordsRequest errors, deployment events, authentication failures
MetricsNumerical trends and aggregationRequest rate, latency, queue depth, CPU usage
TracesEnd-to-end request journeysAPI gateway → service → database
ProfilesResource and code-level behaviourCPU hotspots, memory allocation
EventsSignificant state changesAutoscaling, instance replacement, configuration change

These signals complement one another. A metric may reveal that latency increased; a trace can identify the slow dependency; and logs can explain the exact exception. No single signal is sufficient for every investigation.

Logs

A production log should be structured, usually as JSON, rather than an unstructured sentence. Useful fields include timestamp, severity, service name, environment, region, request or trace identifier, operation, status, error type, and a safe description of the event. Timestamps should use a consistent standard such as UTC and an unambiguous format.

Logs should be designed for both humans and machines. A log message such as “database failed” is less useful than an event containing an error class, dependency name, retry count, and correlation identifier. However, logs must not contain passwords, access tokens, payment-card data, unnecessary personal information, or other secrets. Retention and access must follow organizational policy and applicable privacy law.

Log levels require discipline. ERROR should indicate a condition requiring attention, not every rejected user input. INFO is appropriate for meaningful operational events, while DEBUG is generally controlled because verbose logging increases cost and may expose sensitive information.

Metrics

Metrics are numerical observations recorded over time. Common categories include:

  • Counters, which increase as events occur, such as total requests or total failed requests;
  • Gauges, which represent a current value, such as active connections or queue depth;
  • Histograms, which represent a distribution, such as request-duration buckets;
  • Summaries, which may provide calculated quantiles, depending on the telemetry system.

Metric labels enable dimensions such as service, endpoint, status class, and region. Excessive label cardinality is dangerous: labels containing user IDs, request IDs, or unbounded URLs can create very large and expensive time series. Aggregated metrics should normally use bounded dimensions.

Traces

A distributed trace follows one logical request. It consists of spans, each representing an operation with a start time, duration, attributes, and status. Propagation carries a trace context across service boundaries. OpenTelemetry provides widely adopted APIs and SDKs for generating vendor-neutral telemetry; AWS X-Ray and Google Cloud Trace provide managed analysis capabilities.

Sampling controls storage and processing cost. Head-based sampling decides at the start of a request, whereas tail-based sampling can retain unusual or slow traces after observing their complete behaviour. Sampling must not eliminate all evidence of rare failures; policies should preserve errors and high-latency requests.

2. Cloud-Native Observability Tools

AWS commonly combines Amazon CloudWatch metrics, logs, alarms, dashboards, Logs Insights, Application Signals, and AWS X-Ray. CloudTrail records API activity for governance and security auditing. Managed services such as Amazon ECS, EKS, Lambda, API Gateway, and RDS publish service-specific metrics and logs, although application-level instrumentation remains the responsibility of the team.

Google Cloud commonly uses Cloud Monitoring, Cloud Logging, Log Analytics, dashboards, alerting policies, Error Reporting, Cloud Trace, and Cloud Profiler. Cloud Audit Logs record administrative and data-access activity according to service and configuration. Managed services such as Cloud Run, GKE, Compute Engine, and Cloud SQL expose platform telemetry.

The product names differ, but the design principles are the same:

  1. instrument at the application and platform layers;
  2. centralize and protect telemetry;
  3. correlate telemetry using service, environment, region, version, and trace identifiers;
  4. define retention and cost controls;
  5. provide dashboards for different audiences;
  6. alert only when action is required.

A dashboard is not merely a collection of attractive charts. It should support a decision. An executive dashboard may show user-facing availability and SLO status; a service dashboard may show request rate, errors, latency, saturation, dependencies, and recent deployments; a database dashboard may show connections, locks, storage, replication lag, and query performance.

3. SLIs, SLOs, SLAs and Error Budgets

A service-level indicator (SLI) is a quantitative measure of service performance. An SLI should reflect user experience, not merely infrastructure activity. Examples include successful request proportion, latency within a threshold, freshness of data, and successful job completion.

For a request-based availability SLI:

Availability = (Good events ÷ Valid events) × 100%

A valid event is an event included in the measurement, and a good event satisfies the agreed success criteria. The formula assumes that events are counted consistently and that exclusions are explicitly defined. Availability is dimensionless and expressed as a percentage.

For latency, a useful SLI is the proportion of valid requests completed within a threshold T:

Latency compliance = (Requests with latency ≤ T ÷ Valid requests) × 100%

This is different from average latency. Averages can hide a slow tail, so percentiles and threshold compliance are often more useful for user-facing services.

An SLO is a target for an SLI over a specified time window, such as “99.9% of valid checkout requests succeed each calendar month.” An SLA is a formal agreement, often contractual, defining commitments, measurement rules, exclusions, and remedies. An internal SLO may be stricter or more operationally useful than an external SLA.

Worked Example: Availability and Error Budget

Suppose a service receives 2,000,000 valid requests in a month. Of these, 1,998,200 are successful. The availability is:

Availability = (1,998,200 ÷ 2,000,000) × 100% = 99.91%

If the monthly SLO is 99.9%, the permitted unreliability is 0.1%. The error budget is the amount of unreliability permitted before the SLO is missed:

Error budget fraction = 1 − SLO fraction

Thus:

Error budget = 2,000,000 × (1 − 0.999) = 2,000 events

The service used 1,800 failed events and has 200 events of budget remaining. This calculation assumes that all valid requests have equal importance. If business impact varies significantly, teams may use weighted or separately reported indicators rather than treating every event identically.

Error budgets create a connection between reliability and delivery. When budget remains, a team may accept controlled release risk, experimentation, or architectural change. When the budget is exhausted, the team should prioritize reliability work, freeze high-risk changes, or require additional review. This is a governance mechanism, not a punishment system.

4. Alerting and Operational Dashboards

An alert should be actionable: a responsible person must be able to decide and act on it. Alerts based only on CPU utilization frequently create noise because high CPU may be harmless, while a service may fail with low CPU. User-facing symptoms such as error rate, latency, and failed transactions usually deserve priority.

A practical alert includes:

  • what is abnormal;
  • affected service and scope;
  • start time and duration;
  • severity;
  • a link to the dashboard or runbook;
  • likely impact;
  • ownership and escalation route.

Alert quality can be assessed by the proportion of alerts that lead to meaningful action. Repeated non-actionable notifications cause alert fatigue, delayed response, and eventual disregard of alarms. Use warning notifications for conditions requiring investigation and paging notifications for urgent, user-impacting conditions.

Multi-window, multi-burn-rate alerting is a useful SLO-based approach. A burn rate compares the observed rate of budget consumption with the rate that would consume the complete budget during the SLO window. The exact alert thresholds are policy choices; the underlying principle is to detect both rapid severe failures and slower degradation. Alert policies must be tested, documented, and reviewed after incidents.

5. Reliability and Resilience

Reliability is the probability that a system performs its required function for a specified period under stated conditions. In operations, reliability is usually assessed through user-relevant outcomes rather than component health alone.

Resilience is the capability to withstand disruption, continue providing an acceptable service, and recover effectively. Resilience includes prevention, absorption, recovery, and adaptation. It is not identical to availability: a system can have high availability but poor recovery from a rare catastrophic event.

Important resilience patterns include:

  • redundancy: multiple instances, zones, or regions where justified;
  • health checks: distinguishing process liveness from readiness to receive traffic;
  • timeouts: preventing indefinitely blocked requests;
  • bounded retries: retrying only transient failures and limiting attempts;
  • exponential backoff with jitter: preventing synchronized retry storms;
  • circuit breakers: temporarily stopping calls to an failing dependency;
  • bulkheads: isolating resources so one workload cannot exhaust all capacity;
  • idempotency: allowing safe repetition of an operation;
  • graceful degradation: serving reduced functionality instead of total failure;
  • backpressure and queues: controlling overload;
  • disaster recovery: restoring service after major loss.

Retries require particular care. Retrying a non-idempotent payment operation can create duplicate charges unless an idempotency key or equivalent transaction control is used. A retry policy should specify eligible errors, maximum attempts, total time limit, and jitter. Reliability improvements should be validated through failure testing, capacity tests, and recovery exercises rather than assumed from architecture diagrams.

Recovery objectives provide explicit targets:

  • RTO (Recovery Time Objective): maximum acceptable time to restore service after a disruption;
  • RPO (Recovery Point Objective): maximum acceptable amount of data loss measured in time.

For example, an RPO of 15 minutes means that, under the recovery design, losing more than 15 minutes of data is unacceptable. These are business and technical requirements, not guarantees created merely by purchasing a cloud service.

6. Incident Management

An incident is an event that causes, or may cause, unplanned reduction in service quality, security, or availability. Incident management aims to reduce harm and restore normal service quickly. It is distinct from problem management, which seeks to understand and eliminate underlying causes over a longer period.

A practical incident lifecycle is:

  1. Detection: telemetry, user reports, or operational staff identify abnormal behaviour.
  2. Triage: responders confirm the signal, estimate impact, assign severity, and establish an incident lead.
  3. Containment: stop expansion of harm through rollback, traffic reduction, feature disabling, isolation, or rate limiting.
  4. Diagnosis: use timelines, dashboards, logs, traces, recent changes, and dependency evidence.
  5. Recovery: restore an acceptable service and verify it with user-facing indicators.
  6. Communication: provide accurate, time-stamped updates to stakeholders.
  7. Closure: record actions, owners, evidence, and remaining risk.
  8. Learning: conduct a blameless review and track corrective work.

Roles should be explicit. The incident commander coordinates decisions and priorities. A communications lead manages internal and external updates. Technical leads investigate and execute remediation. A scribe maintains the timeline. In a small team, one person may hold multiple roles, but responsibilities should still be stated.

Severity should be based on customer and business impact, not on the seniority of the person reporting the incident. A useful incident record includes detection time, impact start, affected regions or functions, customer symptoms, hypotheses, commands or changes made, decision rationale, and recovery evidence.

Communication should avoid speculation presented as fact. Updates should state what is known, what is being investigated, current impact, and the next update time. Security incidents require preservation of evidence and coordination with security, legal, privacy, and regulatory functions.

7. Blameless Post-Incident Reviews

A blameless review does not mean that accountability disappears. It means that the review examines system conditions, decisions, controls, and organizational factors rather than seeking a personal culprit. People usually act with incomplete information and within processes created by the organization.

A strong review includes:

  • a concise impact statement;
  • a chronological timeline using reliable evidence;
  • contributing conditions and technical causes;
  • why detection, prevention, or recovery controls did or did not work;
  • what went well;
  • prioritized corrective actions with owners and due dates;
  • follow-up verification.

Corrective actions should be specific and testable. “Improve monitoring” is weak; “add an alert for checkout success below 99.5% for five minutes and test it in staging” is stronger. Actions should address immediate fixes, systemic prevention, detection, recovery, documentation, and training where relevant.

Root-cause language must be used carefully. Complex incidents often have multiple interacting causes, such as an unsafe configuration change, insufficient test coverage, an ambiguous alert, and an ineffective rollback. A single-cause narrative may be convenient but can produce fragile solutions.

8. Applied Case: Illustrative Checkout Incident

Background

A fictional online retailer runs its checkout API on Google Cloud Run, uses Cloud SQL for orders, and publishes payment tasks to Pub/Sub. Cloud Monitoring records request metrics, Cloud Logging stores structured application logs, and Cloud Trace samples distributed requests.

Problem

During a deployment, the checkout success SLI fell from its normal 99.8% to 96%. Customers saw intermittent checkout failures, but CPU and memory dashboards remained within normal ranges. The first alert was generated by the SLO-based error-rate policy.

Analysis

The incident commander confirmed that failures affected one application revision and began a timeline. Traces showed increased latency in the order-creation span. Logs contained repeated database connection-timeout events, correlated by trace ID. A comparison with the deployment timeline showed that the new revision had increased connection concurrency. The database had reached its connection limit, while application instances continued to scale.

The initial symptom was an API error, but the contributing conditions were broader: the deployment changed concurrency without a database-capacity test, the dashboard emphasized compute saturation rather than connection saturation, and rollback instructions were incomplete.

Approach and Solution

The team shifted traffic back to the previous revision, reduced connection concurrency, and confirmed recovery using checkout success, latency, and customer reports. It then added a database-connection saturation dashboard, a deployment guardrail, a tested rollback runbook, and a staging load test. The SLO review also separated checkout success from lower-priority API endpoints so that business-critical impact could be seen clearly.

Outcome and Learning Points

Service recovered without data loss because order creation used idempotency keys and failed transactions were not committed. The post-incident review did not blame the developer who changed concurrency. Instead, it identified a system that permitted an unvalidated production change and lacked a clear dependency-capacity signal. The central lesson is that observability must connect user outcomes to dependencies, and reliability must be managed as a socio-technical system.

9. Governance, Ethics and Contemporary Practice

Observability data can contain personal, financial, or security-sensitive information. Organizations should apply data minimization, access control, encryption, retention limits, audit logging, and documented deletion processes. Sampling and redaction should be designed before production deployment. Access to incident data should follow least privilege because logs can reveal vulnerabilities and user behaviour.

Cloud observability also creates cost and vendor-dependency risks. High-cardinality metrics, long log retention, excessive trace sampling, and duplicate exports can produce substantial bills. Teams should define telemetry budgets, sample intelligently, archive selectively, and review vendor lock-in. OpenTelemetry can reduce instrumentation dependence, although exported data formats and managed analysis features may still differ.

Artificial intelligence can assist with anomaly detection, log summarization, correlation, and suggested probable causes. It should not be treated as an autonomous incident commander. Automated explanations may be incomplete or confidently wrong, and telemetry may contain confidential information. Human responders must validate evidence, preserve auditability, and ensure that automated remediation has safe limits. AI-generated incident summaries should be reviewed before distribution.

Best-Practice Checklist

  • Instrument user journeys, dependencies, and important business transactions.
  • Use structured logs with correlation identifiers and safe data handling.
  • Prefer SLIs that represent customer outcomes.
  • Define SLOs, measurement windows, exclusions, and error-budget policy explicitly.
  • Build dashboards for decisions, not decoration.
  • Page only when a human action is required.
  • Test alerts, rollback procedures, backups, and recovery exercises.
  • Use timeouts, bounded retries, jitter, idempotency, and graceful degradation appropriately.
  • Assign incident roles and maintain a factual timeline.
  • Conduct blameless reviews and verify corrective actions.

Chapter Summary

Observability enables engineers to understand distributed cloud systems through logs, metrics, traces, events, and profiles. Monitoring detects known conditions, while observability supports investigation of unexpected ones. AWS CloudWatch and X-Ray and Google Cloud Monitoring, Logging, and Trace provide managed foundations, but effective results depend on sound instrumentation, correlation, retention, security, and cost design.

SLIs measure user-relevant performance; SLOs set internal targets; SLAs formalize commitments; and error budgets connect reliability decisions with delivery risk. Availability and latency indicators must be defined carefully, with explicit assumptions and valid-event rules. Resilience uses redundancy, timeouts, controlled retries, idempotency, isolation, graceful degradation, and tested recovery objectives. Incident management requires detection, triage, containment, diagnosis, recovery, communication, and learning. Blameless post-incident reviews improve systems by examining contributing conditions rather than assigning personal blame.

Key Terms

Observability: Ability to infer internal system state from external outputs.

Monitoring: Collection and presentation of known operational signals.

Log: Time-stamped record of an event or state transition.

Metric: Numerical measurement recorded over time.

Trace: End-to-end record of a logical request.

Span: Timed operation within a distributed trace.

SLI: Quantitative indicator of service performance.

SLO: Target value or range for an SLI.

SLA: Formal service commitment with measurement and remedies.

Error budget: Permitted unreliability associated with an SLO.

Alert: Notification requiring investigation or action.

Reliability: Ability to perform a required function under stated conditions.

Resilience: Ability to withstand, recover from, and adapt to disruption.

RTO: Maximum targeted time to restore service.

RPO: Maximum targeted tolerable data-loss interval.

Incident: Event causing or threatening unplanned service degradation.

Incident commander: Person coordinating incident response and decisions.

Idempotency: Property that repeating an operation produces an intended equivalent result.

Blameless review: Learning process focused on system conditions rather than personal fault.

Review Questions

Short Answer Questions

  1. How does observability differ from monitoring?
  2. What information should a structured production log contain?
  3. Define an SLI, SLO, and SLA.
  4. Why can excessive metric-label cardinality be harmful?
  5. What is the purpose of an incident commander?

Long Answer Questions

  1. Explain how logs, metrics, and traces complement one another during a distributed-system investigation.
  2. Discuss how error budgets influence release and reliability decisions.
  3. Compare resilience patterns including timeouts, retries, circuit breakers, and bulkheads.
  4. Describe the complete incident-management lifecycle.
  5. Explain the principles and organizational value of a blameless post-incident review.

Analytical / Application Questions

  1. A service records 500,000 valid requests and 499,250 successes. Calculate availability and determine whether it meets a 99.9% SLO.
  2. Design an observability plan for a serverless order-processing system spanning an API, queue, worker, and database. Specify key logs, metrics, traces, dashboards, and alerts.
  3. A deployment causes elevated errors but normal CPU utilization. Develop an investigation and containment plan, including evidence to collect, communications, rollback criteria, and post-incident actions.

Multiple Choice Questions with Answers

Question 1

Which telemetry type is most suitable for following one request across several distributed services?

A. Gauge metric

B. Distributed trace

C. Retention policy

D. Static dashboard

Correct Answer: B. Distributed trace

Question 2

A service receives 1,000,000 valid requests and 999,000 succeed. What is its availability?

A. 99.0%

B. 99.9%

C. 99.99%

D. 90.0%

Correct Answer: B. 99.9%

Question 3

What is the primary purpose of an error budget?

A. To eliminate all production changes

B. To calculate cloud storage cost

C. To connect permitted unreliability with delivery decisions

D. To replace incident communication

Correct Answer: C. To connect permitted unreliability with delivery decisions

Question 4

Which practice best reduces the risk of duplicate effects when a request is retried?

A. Removing timeouts

B. Using idempotency controls

C. Increasing log verbosity

D. Disabling health checks

Correct Answer: B. Using idempotency controls

Question 5

Which characteristic makes an alert operationally useful?

A. It is triggered by every unusual value

B. It requires no human action

C. It provides actionable impact and response information

D. It uses only infrastructure metrics

Correct Answer: C. It provides actionable impact and response information

Question 6

What does RPO describe?

A. Maximum acceptable data-loss interval

B. Maximum CPU utilization

C. Time needed to deploy code

D. Number of replicas required

Correct Answer: A. Maximum acceptable data-loss interval

Question 7

Which statement best describes a blameless post-incident review?

A. It avoids identifying technical causes

B. It focuses on system conditions and learning rather than personal fault

C. It assigns responsibility to the last person who changed code

D. It is conducted only for security incidents

Correct Answer: B. It focuses on system conditions and learning rather than personal fault

Question 8

Why can unbounded user IDs in metric labels be problematic?

A. They prevent timestamps from being recorded

B. They create excessive metric cardinality and cost

C. They automatically encrypt the metric

D. They reduce trace propagation

Correct Answer: B. They create excessive metric cardinality and cost

Question 9

Which role coordinates priorities and decisions during an incident?

A. Incident commander

B. Database replica

C. Build compiler

D. Load balancer

Correct Answer: A. Incident commander

Question 10

A latency SLI based on a threshold T measures which proportion?

A. Requests with latency greater than T divided by all servers

B. Requests with latency ≤ T divided by valid requests

C. CPU time divided by memory size

D. Failed deployments divided by regions

Correct Answer: B. Requests with latency ≤ T divided by valid requests

Cloud Deployment Basics (AWS/GCP)
Chapter 11 of 15