Let’s Get Certified
Module 02 / 13 · Development with AWS services

Choose an event contract

Choose synchronous calls, queues or streaming from the caller’s deadline and delivery needs.

Choose an event contract

An order API can return an inventory decision immediately or return a job ID while work continues. Make that promise explicit before choosing a service. A queue absorbs bursts for a worker fleet. An event bus routes facts to independent consumers by content. A stream preserves a sequence within a partition and supports replay during retention. Bound retries and use stable operation IDs when side effects can repeat.

Validate required fields and schema versions at the boundary. An SDK can sign calls and paginate results, but the application still owns validation, duplicate handling and timeouts. Review AI-generated code with actual sample events and SDK contracts. For a managed AI call, check supported inputs and make an unavailable model a handled dependency failure.

Worked case

A checkout accepted an order and sent a receipt, but the customer got two receipts after a retry. What identity should the handler persist?

Check your reasoning

Use a stable order-and-receipt identifier. Record it atomically with the durable work or use an outbox with an idempotent downstream operation. A fresh request ID identifies each delivery separately.

Second worked case

A stream consumer must notify several handlers when an item changes. Should every handler poll the same standard queue?

Check your reasoning

Consumers on one queue compete for individual messages. For independent handling, fan out a topic or event into separate subscriptions or queues, each with its own retry policy.

Replay an order without charging it twice

Use Python 3 to run the example. Predict how many rows remain when two different orders have the same amount and one delivery repeats.

import sqlite3

db = sqlite3.connect(":memory:")
db.execute("create table charges (order_id text primary key, cents integer)")
for order_id, cents in [("A", 499), ("B", 499), ("A", 499)]:
    db.execute("insert into charges values (?, ?) on conflict(order_id) do nothing",
               (order_id, cents))
print(db.execute("select count(*), sum(cents) from charges").fetchone())
Check your output
(2, 998)

The primary key identifies an order. Summing distinct amounts would lose the second legitimate charge. This example makes the ledger write itself idempotent. An external payment needs its own idempotency or transactional handoff.

AWS event-driven application patterns · Official DVA-C03 objectives for this domain

Related lesson in AWS Certified Solutions Architect – Associate. Decouple admission, processing and delivery.

Streaming a change in customer status

On a Kinesis stream, use a stable partition key when events for one customer require ordering. Consumers retain a checkpoint and can replay within retention. Include a schema version and test a round trip through serialization with an omitted optional field. Contrast that with an SQS work queue where one worker handles each delivered message.

Practice with the recording

A checkout service publishes one event for fulfillment and analytics. Analytics has an outage. How does the publisher avoid coupling the two recoveries?

Check your reasoning

Give each consumer its own durable subscription or queue, with independent retries. Put a stable event identifier in the contract so a replay cannot create a second shipment. Use delivery and processing metrics per consumer to show which part is behind.

Cert Espresso · DVA-C03 full course · 4:28

Apply the current exam objectives

For an application invoking a managed model, define input validation, timeouts, retry limits and the behavior when inference is unavailable. Test a malformed reply and a throttled call. Schema-valid model output still needs application-level validation before it can create a business event.

Practice the individual exam skills
  • 1.1.1–1.1.3 An inventory check must return immediately, while sending the receipt can wait. Draw the synchronous inventory request and the queued receipt separately. Give each a timeout and an explicit fallback. Limit retries to operations that can safely repeat.
  • 1.1.4–1.1.8 Follow one versioned JSON event through API validation, an SDK call and a stream consumer. Reject a malformed field before publishing. Retain the event identifier, partition key and checkpoint so a replay can be distinguished from a new order.
  • 1.1.9–1.1.10 Have a coding assistant propose a client for a managed model. Review the diff, validate the model response against your application schema, then simulate a timeout and a malformed completion before enabling the client.
Knowledge check

Choose an event contract quiz

Answer 3 questions. Check each answer for an explanation.

Worked example · Order identity