Let’s Get Certified
Module 02 / 22 · Architecture Design and Implementation Built for the Cloud

Keep an order consistent across events and services

Trace tenant-scoped state, event delivery, elastic containers and live updates from admission to settlement.

Task 1.1 · Keep an order consistent across events and services

An order survives a deployment

Two tenants can both submit order 731. The API acknowledges accepted jobs, a worker reserves stock, and a customer watches progress over a WebSocket. The deployment terminates a worker after stock is reserved and disconnects the browser. Draw the minimum state required to resume both paths.

Compare your design with the worked answer

Persist a verified tenant/order operation ID and the workflow stage before acknowledging durable admission. Send the same reservation key when reconciling or retrying the stock operation. A replacement worker resumes from durable state. On reconnect, reauthorize the tenant, bind the new connection and replay eligible updates after its cursor. Test the crash and reconnect together using both tenants’ order 731.

If a central account also receives the event, scope its bus permissions and keep the same event identity across forwards. Measure worker backlog and downstream stock capacity before increasing concurrency.

1.1.1 · Deliver an order once at the business boundary

A queue may redeliver after a worker commits a change but before it deletes the message. Carry a stable order ID to the system that performs the side effect. Use a conditional write or a payment provider’s idempotency key there. FIFO message groups preserve order within a group. They do not make an external payment atomic with the queue acknowledgement.

1.1.2 · Remove state from replaceable compute

Classify state by lifetime. A request can carry a signed session reference, while durable cart data belongs in a store accessible to every replica. A cache can accelerate reads if the application tolerates eviction. Test by draining the instance handling an active cart and continuing on a different one.

1.1.3 · Design a replayable serverless data path

Separate admission, durable landing, transformation and query. A retained stream can feed low-latency consumers while raw S3 objects preserve a longer replay horizon. Glue can publish partitions of validated columnar data for Athena. Keep record identities and schema versions so a reprocessing run can replace the intended output.

1.1.4 · Persist waits and compensation decisions

A multistep workflow needs durable state across process exits. Step Functions Standard can record completed steps, wait for callbacks, time out, retry transient failures and run compensation. Give each action its own idempotency contract. Retrying a workflow that already reserved inventory must not reserve it again.

1.1.5 · Route an event across organizational boundaries

Name the source account, destination bus and permitted event types. Authorize delivery on both sides of the cross-account hop, forward only relevant events and alarm on failed delivery. Preserve event IDs for deduplication. Limit forwarding rules so an event returning to its origin cannot circulate indefinitely.

1.1.6 · Choose who operates the scheduler

Existing Kubernetes controllers, admission policies and manifests point toward EKS. A team deploying conventional services can use ECS without introducing Kubernetes. Fargate removes host provisioning for compatible workloads in either supported orchestration context. Evaluate privileged runtime requirements, task duration, AZ capacity and deployment behavior first.

1.1.7 · Control calls between services

An ingress load balancer solves client entry. Internal service discovery, identity-aware access, routing and telemetry have their own boundary. Evaluate VPC Lattice for supported services across VPCs/accounts and ECS Service Connect for ECS service-to-service communication. Trace one internal request through name resolution, authorization and target selection.

1.1.8 · Keep a releasable container image

Pin production to an immutable digest, scan at build and as new findings appear, and keep signed deployment and rollback images through the rollback period. ECR lifecycle rules reclaim storage, but a running task’s cached image is no assurance that a replacement can pull it. Test a clean-host rollback.

1.1.9 · Scale admission and execution separately

Backlog per worker is useful only if each additional worker increases useful throughput. Configure ECS desired tasks or Kubernetes pods and ensure nodes or Fargate capacity can place them. For Lambda, concurrency can protect a downstream database. Observe queue age, placement failures and throttling together.

1.1.10 · Select ingress from client behavior

An ALB can route HTTP by host or path. An NLB fits transport-level requirements and stable ingress addresses. API Gateway adds managed API controls, and the AWS Load Balancer Controller can provision appropriate AWS ingress resources from Kubernetes configuration. Size for concurrent connections and protocol behavior, not just request counts.

1.1.11 · Put bounded logic at the edge

A lightweight viewer-request rewrite can run in CloudFront Functions at the edge. Lambda@Edge supports more involved supported triggers, including origin-side processing, subject to its execution restrictions. Decide whether the operation must run on every viewer request or only when CloudFront contacts the origin. Include cache-key and privacy implications.

1.1.12 · Preserve subscription state for live updates

API Gateway WebSocket APIs maintain client connections, while application code records connection IDs and authorized subscriptions outside the worker. Fan out new events to eligible connections and remove stale IDs on disconnect or failed delivery. Provide a resume cursor or snapshot if clients must recover missed updates.

1.1.13 · Enforce isolation at the data boundary

Derive tenant identity from a verified identity and enforce it on every access. A pooled store can enforce tenant-scoped keys or row policies. Silo resources or keys when stronger boundaries are necessary. Include tenant identity in caches, background jobs and exports. Test the same object identifier with two authorized test tenants.

Apply the video example

In the visibility-timeout demonstration, put a worker failure just after its business write. Moving the visibility deadline reduces overlap; the persisted tenant/operation identity protects the effect even when redelivery occurs later.

freeCodeCamp · 37:34:16 in SQS

Official SAP-C03 task 1.1

Return to the objective map

Knowledge check

Keep an order consistent across events and services quiz

Answer 13 questions. Check each answer for an explanation.