All lessons in Cloud Engineering: Deploy, Operate, and Recover
Define a Cloud Service Contract
Specify users, workload boundaries, service targets, and evidence for a useful cloud deployment.
30 minutes · Free lesson
What you will learn
- Translate a service request into workload boundaries and observable operating targets.
- Separate a useful service outcome from a successful resource deployment.
- Define the evidence, budget, and stopping conditions for a cloud investigation.
A records team wants customers to check whether a submitted document has been reviewed. Its first request is to put the service in the cloud. Before choosing a provider product, identify the decision a customer needs to make: whether to wait, correct a submission, or contact the team. A running container is useful only if it supports that decision reliably.
Throughout this course you operate Northstar Records, a small fictional document-status service. You use synthetic status data, inspect requests, change releases, and recover from failures. The same service connects the lessons so that networking, identity, cost, and recovery decisions constrain one another.
You need basic terminal, Git, and HTTP familiarity. A local workbook supports the required investigations without paid infrastructure. The Azure runbook is a separate execution track using your own sandbox; its provider-specific results must be measured there. Reading or running a local simulation does not prove a cloud deployment has succeeded.
The required course takes you from this contract to an operational handoff. Optional programmes extend that work into Kubernetes operations, infrastructure automation, multi-region recovery, cloud service architecture, reliability engineering, secure platform delivery, and FinOps. Each programme has ordered phases and a cumulative deliverable. Choose the specialization that supports your next engineering decision; its assessment is separate from core completion.
Describe the useful transaction
Begin with the caller, input, available information, and useful response. A customer supplies an opaque document identifier. The workbook service returns a status and snapshot revision. A missing record produces a defined not-found response. A revision identifies the selected snapshot; it does not establish when the underlying business event occurred. A future freshness requirement needs an explicit event-time contract. The first version does not upload documents, edit records, process payments, or reveal internal reviewer notes.
Separate the external contract from the implementation. The customer should not need to know which container instance answered. If an instance restarts, a status query should still follow the same response rules. That requirement affects how you store state and how you route requests; it is not a reason to promise that failures never happen.
Write negative cases alongside positive ones. An unknown record is different from a failed dependency. Returning a successful empty response for both conceals an outage as a business fact. A malformed request, denied request, and temporary inability to retrieve data need distinct handling and observability.
Make workload assumptions explicit
Describe ordinary traffic, bursts, payload sizes, and dependency behavior. An average of ten requests per second does not mean the service sees exactly ten in each second. A batch customer might create a sharp morning burst; a retrying client can amplify traffic during a fault. State the observation period and how the estimate was obtained.
For the exercises, assume 120,000 eligible status requests during a planning period, with a short peak of 40 requests per second. These numbers are invented fixtures. They let you compare designs without presenting a fictional workload as a real customer measurement.
Distinguish a target from an assumption. Peak arrival rate is an input to capacity planning. A response-time objective is a desired result. Capacity experiments test whether the implementation meets that result under the stated input. Changing both the input and the target after a failure makes the experiment difficult to interpret.
| Contract element | Northstar example | Evidence to retain |
|---|---|---|
| Useful operation | Return a permitted document status | Response assertions for known and unknown IDs |
| Traffic | Ordinary load plus a bounded burst | Request counts and arrival schedule |
| Availability | Eligible requests receive valid responses | Good/total event counts with exclusions defined |
| Recovery | Restore a usable status snapshot | Failure time, restore time, missing-record ledger |
| Resource boundary | One learner-owned sandbox | Inventory and teardown results |
Choose targets that can be assessed
Define success from the user's viewpoint. A process-health endpoint can establish that the process is alive; it cannot establish that customers receive correct status data. Use an eligible status request as the primary event and explain which failures count. Excluding inconvenient failures without a reason makes the metric look better while weakening the contract.
Keep an internal service objective separate from a provider's service agreement. Your service depends on configuration, application behavior, clients, and multiple resources. A provider's published availability figure is not a measured end-to-end result for your system. The Azure Well-Architected framework provides a useful set of design concerns, but your acceptance evidence must come from your workload.
Worked example
Turn a target into a finite allowance
- Northstar's invented contract permits at most 0.5% bad outcomes among 120,000 eligible requests in a planning period.
- The allowance is 120,000 × 0.005 = 600 bad requests. This is a request-based allowance, not 600 minutes of downtime.
- A release investigation records 180 bad requests. It consumes 180 / 600 = 30% of that period's allowance.
- A second service with twice the requests would have a different count allowance under the same percentage. Always retain the denominator.
- These calculations help define the experiment. They do not establish that either service meets its objective in production.
Bound the investigation and its costs
Write what you may change, what you must preserve, and when you will stop. For a local exercise, create a separate working directory and synthetic data. For an Azure sandbox, identify the subscription, dedicated resource group, region, resource inventory, spending limit, and cleanup owner before creating resources.
A cost alert is an observation mechanism, not a universal guarantee that spending stops. A small service can incur charges through logs, storage, network traffic, or forgotten resources even when its application is idle. The course therefore treats teardown and cost assumptions as part of the deliverable rather than an afterthought.
Define three levels of evidence in your project notes: a design claim, a local observed result, and a provider-observed result. A plan may specify a managed identity. A local policy fixture may test the intended permission table. Only the provider investigation can establish the actual identity and its effective authorization in that sandbox.
Start Northstar and specify its responses
Download and extract the workbook. Open two terminals in the extracted cloud-engineering-labs directory. All local commands in this course run from that directory. You need Python 3.10+, a POSIX shell such as bash/zsh, and curl. A cloud subscription is used only for the Azure exercises.
Check Python:
python3 --version.Create a disposable working copy:
mkdir -p .workfollowed bycp fixtures/status.json .work/status.json.In terminal A, start the service:
python3 service.py --data .work/status.json --port 8765 > .work/events.jsonl 2>&1.In terminal B, inspect a response:
curl --max-time 5 -i http://127.0.0.1:8765/status/DOC-100.Run the four interface checks:
python3 probe.py --url http://127.0.0.1:8765.
Expect HTTP 200, status complete, and revision R104 for DOC-100. The probe should print "passed": true. Its unknown-record check expects 404. Stop the service with Ctrl-C in terminal A when finished; restart it for later HTTP exercises. A connection refusal means there is no reachable listener at that address, so inspect terminal A before editing application data.
Write the contract in terms of these observable results: known record returns the expected status; unknown record returns 404; unavailable data returns 503. Keep health and readiness as separate supporting checks. The capstone will introduce a candidate that is healthy but violates this response contract.
Exercise
The container deployment succeeds, but every known status query returns an empty response. Which contract has passed and which evidence is still missing?
Check your answer
Resource deployment may have passed. The useful transaction has not: test known IDs against expected statuses, distinguish not-found from dependency errors, and retain request and response evidence. Process or deployment health cannot replace this result.
Exercise
For 80,000 eligible requests and a 99.5% success objective, calculate the allowed bad requests. If 100 fail, what fraction of the allowance is used?
Check your answer
The allowance is 80,000 × 0.005 = 400 bad requests. One hundred failures consume 100 / 400 = 25% of the allowance. State the planning period and eligibility rule with the result.
Exercise
The probe passes. Change only the expected revision to R999 and run it again. Which checks should fail, and why?
Check your answer
Run python3 probe.py --url http://127.0.0.1:8765 --expect-revision R999. Readiness and DOC-100 should fail their revision assertions; process health and unknown-record behavior should still pass. The process exits 1. This proves the check can reject an incorrect contract even when HTTP requests succeed.
Summary
Start with a useful transaction, bounded workload, and observable targets. Connect every design claim to evidence and keep local results, provider results, and assumptions distinct.
Next action
Choose which operational responsibilities Northstar retains when moving from a virtual machine to a managed runtime.