Enterprise cloud architecture capstone
The enterprise brief: design before deploying
A capstone combines previously learned skills into one coherent engineering decision. Design a fictional wholesale ordering service, Harbor Supply, serving 20 business tenants. It accepts orders, returns order status and asynchronously produces a synthetic fulfillment notification. There are no real payments, customer records or external integrations. Read the migration, tenant isolation, specialized deployment, efficiency, release engineering and portfolio lessons first.
The deliverable is an evidence-backed design and local rehearsal, not a deployed system. Compare two viable alternatives under the same assumptions, write a high-level design (HLD) and low-level design (LLD), and state which tests remain unexecuted. In the next lesson you will run a reference model and prepare an operational handoff.
Translate business needs into measurable acceptance criteria
| ID | Requirement | Evidence required before real launch |
|---|---|---|
| R1 | 100 requests/s normal, 300 requests/s peak; p95 <= 250 ms for order API at each load | Representative load and error-rate test, including DB limits |
| R2 | 99.9% successful eligible requests over a rolling 30-day window | Defined request SLI, measured numerator/denominator; alert on burn rate |
| R3 | No cross-tenant order access; unique effect for retried order/event | Negative authorization and concurrent replay tests |
| R4 | Regional disaster RTO <= 60 min, RPO <= 5 min | Timed recovery drill and verified consistent checkpoint |
| R5 | Order data, backups, logs and keys within approved locations A and B only | Inventory and verified data paths, legal/contract review |
| R6 | Peak monthly modeled cloud charges <= 1,100 fictional USD | Dated usage model, approved scope and sensitivity |
| R7 | Independent approval tied to immutable release artifact; scoped identity | Provenance, policy checks, approval and deployment audit |
A and B are symbolic approved regions, not real provider region identifiers. A real region pair must satisfy the organization's actual residency and availability requirements. The request-based SLO allows 0.1% unsuccessful eligible requests: at 1,000,000 eligible requests, the budget is 1,000 failures. A time-based 99.9% target over 30 days would allow 43.2 minutes, but that is a different SLI. The recovery objectives are business constraints, not service promises. Use a written risk register and named reviewers.
Two high-level architectures with a justified primary provider
A: Client -> HTTPS load balancer -> private container API -> relational DB | | | transaction + outbox | | +---- worker <- queue <- relayB: Client -> HTTPS API gateway -> bounded function API -> relational DB | | | transaction + outbox +--- function <- queue <- relayBoth: identity, private data paths, restricted telemetry, backups, separate recovery region B and verified recovery procedure.A uses Amazon ECS on Fargate, an Application Load Balancer, Amazon RDS for PostgreSQL, SQS and object storage for synthetic receipts. B uses API Gateway, Lambda, SQS and a compatible RDS database; evaluate a database connection proxy and explicit concurrency limits. A persistent relay polls committed outbox records; B can use a scheduled bounded relay. Both must support retries, backpressure and safe recovery. Neither is automatically cheaper, faster or more reliable. An RDS Multi-AZ DB instance has a standby for failover, not read scaling; a regional disaster requires separate recovery design.
For this fictional company, choose AWS provisionally because its team already operates AWS identity and relational workloads. Choose A for the pilot because steady traffic and long-lived connection pools match the existing operations skill set. B is a credible alternative if the workload becomes bursty and measured connection demand and duration fit function limits. Both require real validation. Azure Container Apps or App Service with a queue worker and Azure Database for PostgreSQL are alternative building blocks; Cloud Run, Pub/Sub and Cloud SQL are Google Cloud candidates. Do not equate their networking, authentication, queue semantics or database failover. No need to deploy a second provider just to call a system multi-cloud. The optional portability subset is an offline message-contract test, with a second-provider adapter design only.
Low-level design: ownership, network and data contracts
Separate production, nonproduction, shared security/log archive and billing administration using provider resource hierarchy. Development uses synthetic data. Production and recovery each have distinct networks, private application and database subnets in suitable zones; public ingress terminates HTTPS at the approved edge only. Permit application-to-database connections on the configured database port from its workload security boundary; disallow Internet database access. Limit outbound connectivity to reviewed service paths (image pulls, identity, secrets, queue and telemetry); verify endpoint availability and routing. Separate ECS task role from the role used by the runtime to pull images and deliver logs. The API may write orders and outbox records; the relay may read/update outbox and send queue messages; the worker consumes and writes fulfillment state; the migration role is temporary. Do not share administrator credentials. Authorization is enforced at the application and data boundaries.
| Contract | Design |
|---|---|
| POST /orders | Verified tenant identity, tenant-scoped idempotency key and validated integer quantity; identical retries return same result, conflicting reuse rejected |
| GET /orders/{id} | Tenant-scoped lookup; unknown or unauthorized records do not reveal another tenant's existence |
| Database | Composite tenant/order key, unique tenant/idempotency key, outbox event ID, bounded DB connections |
| Event v1 | event_id, tenant_id, order_id, quantity; no personal data; immutable identity and version |
| Worker | Durable event-ID deduplication scoped to tenant; effect and dedup record committed atomically before acknowledgment |
| Object store | Private tenant-scoped receipt key, encryption, verified retention and access |
Commit order and outbox in one database transaction. A relay publishes committed events then marks them dispatched; a crash between those actions can duplicate delivery. The consumer must deduplicate; a dead-letter queue and controlled replay address poison events. Never assume a queue grants end-to-end exactly-once behavior. On ambiguous API timeout, retry with the same idempotency key and compare payload. Data migrations use expand/contract schema changes and explicit compatibility windows. Restrict logs to synthetic request IDs and outcome metadata, not request payloads or credentials.
Capacity, FinOps and selection gate
The following rates and monthly charges are invented USD, not quotes. Each alternative includes a small recovery environment allowance but no taxes or staff costs; verify actual recovery topology and all charges before deployment.
| Monthly component | A normal | B normal |
|---|---|---|
| API/worker compute | 300 | 140 |
| Database | 260 | 260 |
| Ingress, network, transfer | 120 | 120 |
| Storage, backup, queue | 80 | 80 |
| Monitoring/security | 60 | 60 |
| Recovery allowance | 100 | 100 |
| Total | 920 | 760 |
Peak assumption adds 100 to A and 300 to B, resulting in 1,020 and 1,060; headroom is 80 and 40. If B needs 70 more for connection management, peak becomes 1,130 and fails the budget. A rough concurrency model uses arrivals per second times mean service time: 300 requests/s times 0.2 s gives 60 concurrent requests on average under stable conditions. It is not a p95 latency or saturation bound. Set queue and DB caps based on actual measured limits. For example, 4 container tasks with 10 connections each use up to 40 app connections; reserve additional capacity for worker, migrations, monitoring and failover. B needs a bounded concurrency/connection design and load test. Track successful orders per vCPU-hour and total cost, not only unit cost. Review whether recovery allowance is sufficient; budget estimates do not guarantee charges.
The following Python 3 model selects eligible review candidates using fictional charge estimates and explicit mandatory evidence labels. It does not choose providers or grant launch approval. It validates nonnegative integer cents, exact gate names, and known states.
Run the offline architecture review
GATES = {'location', 'identity', 'capacity', 'recovery'}
def candidate(parts, peak_extra, budget, gates): if not parts or any(type(x) is not int or x < 0 for x in [*parts, peak_extra, budget]): raise ValueError('nonnegative integer cents required') if set(gates) != GATES or any(v not in {'pass', 'fail', 'unknown'} for v in gates.values()): raise ValueError('invalid gate states') total = sum(parts) + peak_extra if total > budget or 'fail' in gates.values(): return ('blocked', total, budget - total) if 'unknown' in gates.values(): return ('needs-evidence', total, budget - total) return ('candidate', total, budget - total)
ready = dict.fromkeys(GATES, 'pass')a = [30000, 26000, 12000, 8000, 6000, 10000]b = [14000, 26000, 12000, 8000, 6000, 10000]print(candidate(a, 10000, 110000, ready))print(candidate(b, 37000, 110000, ready))print(candidate(a, 10000, 110000, dict(ready, recovery='unknown')))Expected output:
('candidate', 102000, 8000)('blocked', 113000, -3000)('needs-evidence', 102000, 8000)All pass states are invented fixture inputs. In a real design, capacity, recovery and policy evidence remain unknown until tested. Candidate is not release approval. Write ADR-060-01 documenting A and B, owner, evidence, budget and revisit trigger. Add a second ADR for regional recovery, a threat model, an IaC outline and the test matrix described in the next lesson. Read the staged capstone brief for the exact deliverables and a reference solution.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Enterprise cloud architecture capstone — knowledge check
Choose the best answer for each offline scenario.
Which alternative is eligible if its peak estimate is 1,130 and budget is 1,100?
Why use a transactional outbox?
What does a single-standby RDS Multi-AZ DB instance provide?
At 300 requests/s and mean duration 0.2 s, what is modeled average concurrency?
Which artifact explains why a provider/runtime was chosen?