Cloud Infrastructure Fundamentals · Module 10 of 12

Monitoring, logging and cost

Connect metrics, logs and audit trails to operational health, then use tagging, budgets and basic FinOps controls to keep cloud usage accountable.

Learning objectives

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

  • Distinguish metrics, logs and audit trails and choose the right signal for a question.
  • Design actionable alerts for user-visible symptoms and capacity risk.
  • Use tags/labels to connect cloud resources to owner, environment and cost accountability.
  • Explain budgets, cost controls and basic FinOps feedback loops.

Telemetry types answer different questions

Metrics show numeric trends, logs provide event detail, traces connect distributed request spans, and audit logs record control-plane/API activity. Effective troubleshooting correlates them.

Alert on user-visible or capacity symptoms

A useful alert has an actionable condition, owner and response. Saturation, error rate, latency and availability are generally more useful than arbitrary low-level noise.

Audit evidence is part of security operations

Cloud API audit logs help answer who changed what, when and from where. Protect retention and centralize logs so a compromised workload cannot trivially erase its own evidence.

Cloud cost is usage multiplied by service pricing dimensions

Compute duration/size, storage capacity/requests, data transfer, managed-service hours and provisioned capacity are common dimensions. Architecture choices can create indirect charges.

Tags connect resources to accountability

Consistent tags such as owner, application, environment and cost-center support inventory, policy and cost allocation. Tagging standards need enforcement because optional tags decay quickly.

Budgets and quotas are early-warning guardrails

Budgets notify about spend/forecast thresholds; service quotas and policy guardrails can constrain accidental scale. Neither replaces architecture review or resource cleanup.

Network flow logs connect routing and security to observability

VPC Flow Logs record metadata about IP traffic for VPC resources and can help answer whether traffic was accepted/rejected and which addresses/ports were involved. They complement application logs and metrics but do not contain full packet payloads.

Correlate flow records with route tables, security-group/NACL configuration, load-balancer health and application logs instead of treating a rejected flow record as a complete root-cause explanation.

Cloud economics is shaped by purchasing model and data movement

On-demand capacity emphasizes flexibility. Committed/reserved pricing can reduce unit cost when usage is predictable. Spot/interruptible capacity can be economical for fault-tolerant work that can survive interruption. Storage tiers trade access cost/latency against capacity price.

Idle resources, over-sizing, always-on non-production systems, managed-service baseline charges and data transfer/egress are common cost drivers. Optimization is a trade-off exercise: do not remove resilience or security simply to make a bill smaller.

Worked examples

See the idea in practice.

Signal map

Latency spike → metric
Failed deployment detail → application/deployment log
Cross-service request path → trace
Security-group modification → control-plane audit event
  • Correlate using timestamps, resource identity and request IDs where available.

Simple monthly estimate

3 instances × 730 hours × $0.05/hour = $109.50
200 GB storage × $0.10/GB-month = $20.00
Illustrative subtotal = $129.50
  • Numbers are intentionally illustrative, not current provider prices.
  • Always use the provider pricing calculator for real decisions.
Core lab · Modes 1–2 · Concept + local simulation

Lab — Correlate service telemetry with an illustrative cost model

Goal: Calculate an error/latency health signal and a simple monthly cost model locally, then identify one operational and one cost action.

Before you start

  • No cloud account required.
  • Numbers are illustrative teaching inputs, not current provider prices.
STEP 1

Create telemetry and cost inputs

cat > /tmp/cloud-ops.json <<'JSON'
{"requests":10000,"errors":75,"latency_p95_ms":420,"cost":{"compute":109.5,"storage":20,"transfer":10}}
JSON
STEP 2

Calculate the indicators

python3 - <<'PY'
import json
d=json.load(open('/tmp/cloud-ops.json'))
print('error_rate_pct', round(d['errors']/d['requests']*100,2))
print('monthly_cost_model', round(sum(d['cost'].values()),2))
print('largest_cost_driver', max(d['cost'], key=d['cost'].get))
PY
STEP 3

Choose controls

Write one alert condition for service health and one cost control such as an owner tag, budget threshold, rightsizing review or non-production shutdown policy.

STEP 4

Choose a cost model for three workloads

python3 - <<'PY'
choices={'steady_database':'commitment_candidate','interruptible_batch':'spot_candidate','unknown_launch_traffic':'on_demand_candidate'}
for k,v in choices.items(): print(k,'->',v)
assert choices['interruptible_batch']=='spot_candidate'
PY

Verify

  • The modeled error rate is 0.75%.
  • The illustrative cost total is 139.50 and compute is the largest modeled driver.
  • You can distinguish when on-demand, commitment and interruptible capacity are plausible candidates without treating any one model as universally cheapest.

Expected outcome

  • You connect operational telemetry and cost telemetry to concrete action instead of treating either as a dashboard-only activity.

Diagnose / troubleshoot

  • If error rate looks wrong, verify numerator/denominator and time window before changing alert thresholds.
  • If a network failure has no application log, inspect VPC Flow Logs plus routes/SG/NACL state before assuming the process is down.
Real-world connection

FinOps is a continuous engineering/finance feedback loop: understand usage, assign accountability, optimize architecture and verify whether changes improve cost without harming reliability.

Mode 3 · Optional AWS lab

Optional AWS — inspect observability and cost metadata

Read existing CloudWatch alarm, CloudTrail trail and budget metadata where the sandbox identity is permitted.

Resources created

  • None — this is a read-only inspection lab.

Estimated cost / risk

  • Expected incremental resource cost: none because the supplied commands are read-only.
  • Existing resources in the account can still incur their normal charges; confirm current AWS pricing for the selected Region/account.

Prerequisites

  • Optional sandbox AWS account and AWS CLI.
  • Use a least-privilege or federated identity; do not paste long-lived access keys into course files.
AWS 1
aws cloudwatch describe-alarms --query 'MetricAlarms[].{Name:AlarmName,State:StateValue}' --output table
AWS 2
aws cloudtrail describe-trails --query 'trailList[].{Name:Name,HomeRegion:HomeRegion}' --output table
AWS 3
aws ec2 describe-flow-logs --query 'FlowLogs[].{Id:FlowLogId,Resource:ResourceId,Traffic:TrafficType,Destination:LogDestinationType,Status:FlowLogStatus}' --output table
AWS 4
aws budgets describe-budgets --account-id $(aws sts get-caller-identity --query Account --output text) --query 'Budgets[].{Name:BudgetName,Limit:BudgetLimit.Amount,Unit:BudgetLimit.Unit}' --output table

Verify

  • Available alarm, audit-trail, VPC Flow Log or budget metadata is displayed; permission denial is treated as a least-privilege boundary, not a prompt to broaden access.
  • No AWS resources are created by the supplied commands.

Cleanup

  • No AWS cleanup is required because this lab creates no AWS resources.

Warnings

  • Optional only: not required for course completion or the main validator.
  • Budgets and cost tools have provider-specific behavior; verify current documentation and pricing before production use.
Avoid these traps

Common mistakes

  • Alerting on every single error.
  • Keeping critical audit logs only on the instance that generated them.
  • Using metrics without labels/dimensions that identify affected resources.
  • Leaving resources untagged and ownerless.
  • Optimizing cost without checking reliability/security consequences.
  • Ignoring network-egress and managed-service baseline charges.
Knowledge check

Can you explain it without looking back?

Open each answer only after you have tried to answer the question yourself.

1What is the difference between metrics and logs?

Metrics are structured numeric time-series signals suited to aggregation/alerting; logs are event records with richer contextual detail.

2Why tag resources with owner and environment?

To connect usage and cost to accountability, filtering, automation and reporting.

3What is basic FinOps awareness?

Treating cloud cost as an observable engineering variable and iterating across visibility, accountability and optimization rather than reviewing bills only after the fact.

4Scenario: a TCP connection fails and application logs show no request. Which cloud telemetry is a useful next source before changing firewall rules?

VPC Flow Logs can show network-flow metadata such as addresses, ports and accept/reject disposition; correlate them with routes and security controls.

My Learning

Record your progress for this module.

Progress is saved in this browser immediately. When you sign in to My Learning, it can also sync across devices.

Not started

Attempt the core lab and knowledge checks before marking the module complete.