Requirements, architecture and cost alternatives
Start with a problem and explicit constraints
Cedar Learning Supplies is a fictional organization selling classroom kits. Customers submit orders and check their own order status; workers fulfill accepted orders asynchronously. Assume 100,000 accepted orders per month, 20 requests per second normally and 200 at peak, acceptance p95 below 300 ms, 99.9% monthly request success, regional-disaster RPO 60 minutes and RTO 4 hours. The illustrative monthly cap is $500. Only approved synthetic records are used. Payment processing, shipment and personal-data collection are outside this project. A successful response means an order was durably accepted, not shipped. Specify a separate fulfillment objective of p95 below 60 seconds. Revisit estimates when demand or access patterns change.
Variant A: event-driven serverless
Use Route 53 and a validated ACM certificate for the custom domain of a regional API Gateway HTTP API. A JWT authorizer checks identity; Lambda must also enforce tenant and object authorization. Store orders and outbox records atomically in DynamoDB using transactions. A stream-triggered dispatcher processes only outbox records and publishes to SQS; replay may publish twice, so a separate worker uses a conditional transaction to record a unique fulfillment effect. Reconcile undispatched orders because stream retention is finite. API Gateway and DynamoDB are managed regional services, not servers placed in your public subnet. Lambda need not join a VPC unless private dependencies require it. If needed, use private subnets and appropriate endpoints or egress; do not attach a VPC merely for appearance. Use separate execution roles for API, dispatcher and worker; encrypt data and restrict logs. The design supports predictable key access, not arbitrary relational joins.
Variant B: containers and relational storage
Route 53 resolves a public ALB with ACM TLS. Across two AZs place ALB nodes in public subnets, ECS Fargate API and worker tasks in private application subnets without public IPs, and an RDS PostgreSQL Multi-AZ instance in isolated database subnets. Example CIDRs are in the project worksheet; the application security group permits API ingress from the ALB group and the database group permits TCP 5432 from approved application groups only. Worker tasks poll SQS without public ingress. Use a transaction for order plus outbox, a bounded dispatcher, and a unique fulfillment-effect constraint. Keep database credentials in Secrets Manager and distinguish task roles from execution roles. Plan NAT or the required service endpoints for image pulls, logging, secrets and queue access. Scale tasks on observed demand and limit connections to the database. Multi-AZ helps instance/AZ resilience; regional DR needs separate backups and recovery planning.
Defend a choice using an auditable cost model
The fixture uses invented monthly cents: A compute 9000, API 3000, data 5000, queue 1000, logs 3000, network 2000, recovery 6000 = 29000 ($290); B compute 14000, ALB 3000, data 12000, queue 1000, logs 3000, network 6000, recovery 8000 = 47000 ($470). At 100000 accepted orders these are $0.0029 and $0.0047 per order, before tax or omitted charges. Hypothetical peak estimates are $430 and $650. Under this local budget policy only A fits normal and peak estimates, provided joins are not mandatory. If joins become mandatory and cannot be redesigned, neither qualifies at peak: renegotiate requirements or redesign. Verify actual regional rates, quotas, recovery costs and performance independently. See the project STARTER.md and REFERENCE-SOLUTION.md for the full worksheet.
{ "A": { "compute": 9000, "api": 3000, "data": 5000, "queue": 1000, "logs": 3000, "network": 2000, "recovery": 6000 }, "B": { "compute": 14000, "alb": 3000, "data": 12000, "queue": 1000, "logs": 3000, "network": 6000, "recovery": 8000 }}Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Requirements, architecture and cost alternatives — knowledge check
Defend architecture choices, tenant boundaries and recovery evidence.
What does a successful acceptance response prove?
Which variant needs private database subnets in this design?
Why use an outbox?
Which variant fits both invented monthly cost scenarios?
If mandatory joins rule out A and B exceeds the peak cap, what follows?