Cloud concept · Updated

Event-Driven Architecture - Event-driven architecture is a software design approach in which components publish events and other components react to them through loosely coupled communication.

In short

An event records something that has happened, such as an order being placed, a file being uploaded, or a monitoring threshold being crossed. By separating event producers from consumers, this architecture lets cloud applications process work independently, absorb traffic spikes, and deliver notifications without requiring every component to respond at the same time.

Cloud Concepts Hub →

6 key aspects of Event-Driven Architecture

Event-driven architecture combines loose coupling, asynchronous delivery, deliberate messaging patterns, and explicit reliability controls so components can react independently to changes.

01
Producers and consumers are loosely coupled

Producers publish facts without needing to know every consumer's implementation. New consumers can subscribe or receive routed events without adding direct calls to the producer.

02
Asynchronous processing and buffering

Consumers process events independently of the originating request. Queues can absorb bursts, but engineers must monitor backlog and processing latency to ensure consumers eventually catch up.

03
Distinct delivery patterns

Use competing consumers for shared background work, publish-subscribe for fan-out, and event routing for selecting targets by event attributes. Multiple recipients needing independent copies generally require separate subscriptions or queues.

04
Explicit delivery and failure handling

Choose delivery and ordering guarantees deliberately rather than assuming them. Use idempotent handlers, bounded retries, and dead-letter handling where supported to manage duplicate deliveries and persistent failures.

05
Eventual consistency and clear contracts

Different components may reflect an event at different times. Define stable event schemas, version changes carefully, and design user interfaces and workflows to represent pending processing.

06
End-to-end operational visibility

Carry event and correlation identifiers through the processing chain. Monitor failed deliveries, queue age, consumer errors, and notification outcomes rather than treating successful publication as successful completion.

Cloud services for Event-Driven Architecture

A producer can publish an event to EventBridge for content-based routing, or to SNS when the primary need is distributing messages to subscribers. SNS can fan out to separate SQS queues so each downstream application buffers and processes its own copy independently. Lambda can consume queued messages or handle supported event deliveries, then call SES when processing requires a transactional email. Separately, CloudWatch alarms can publish to SNS to notify operators about failures or resource thresholds. Select the service by responsibility: monitoring detects conditions, messaging transports or routes information, consumers perform work, and notification channels reach people.

Amazon EventBridgeAmazon EventBridge

EventBridge event buses receive events from applications, AWS services, and supported external sources, then use rules to route matching events to targets. It is useful when different event types or attributes should trigger different downstream actions.

Amazon CloudWatchAmazon CloudWatch

CloudWatch monitors operational signals and evaluates alarms. Alarm actions can publish to SNS, separating detection of an operational condition from delivery of the resulting notification.

AWS LambdaAWS Lambda

Lambda runs event-handling code without provisioning servers. Functions can receive events through supported integrations, including SNS and EventBridge, or process SQS messages through an event source mapping.

Event-Driven Architecture exam questions

Real practice exam questions on Event-Driven Architecture, with the correct answer and its explanation. Answer them with every option in the exam simulator.

CLF-C02

A company wants to automatically run an AWS Lambda function whenever an Amazon EC2 instance enters the stopped state. The solution must use the state-change events that EC2 generates, without polling instances or writing code to publish notifications. Which solution best meets these requirements?

Show answerCORRECT ANSWER

Create an Amazon EventBridge rule that matches EC2 state-change events with a state of stopped, and configure the Lambda function as the target.

EventBridge receives EC2 state-change events and can match their contents with a rule. The rule can route matching events to Lambda without polling instances or requiring custom notification-publishing code.

MLA-C02 (beta)

A retailer uses an Amazon EventBridge rule to start an AWS Step Functions Standard workflow whenever a new labeled dataset is ready. The workflow first preprocesses the dataset and then submits an Amazon SageMaker training job. Each workflow execution always runs preprocessing before reaching the training task.

Occasionally, the training job submission is rejected with a transient API throttling error before a training job is created. The workflow then fails, even though EventBridge successfully delivered the event. The EventBridge target's dead-letter queue remains empty.

The retailer wants future executions to retry these transient submission failures automatically without rerunning successful preprocessing. Which change meets this requirement?

Show answerCORRECT ANSWER

Add a bounded Retry policy with exponential backoff to the training task state, matching the transient throttling error returned by the integration.

A Step Functions task-level Retry policy handles the failure where it occurs. It retries the training submission within the existing execution, preserving the successful preprocessing output and avoiding another preprocessing run.

AIP-C01

A travel company stores confirmed bookings in an Amazon Aurora PostgreSQL database. It wants to generate a personalized itinerary for each confirmed booking by invoking a foundation model in Amazon Bedrock. Booking confirmation must not wait for itinerary generation, and an inference outage must not prevent customers from completing bookings.

Every committed booking must eventually have an itinerary after transient failures recover. Rolled-back bookings must not trigger itinerary generation. Application processes and message publishers can crash at any point, including between a database commit and a messaging API call. Duplicate inference attempts are acceptable, but only one itinerary may be committed for each booking ID. The company does not use distributed transactions between its database and messaging services.

Which architecture meets these requirements?

Show answerCORRECT ANSWER

Insert the booking and an outbox record in the same database transaction. Have a relay publish committed outbox records to an Amazon SQS queue and mark them delivered only after successful publication, retrying unacknowledged records. Have workers invoke Amazon Bedrock, conditionally commit one itinerary per booking ID, and acknowledge messages only after the result is durably stored.

The database transaction atomically commits both the booking and the durable obligation to publish its event. Rolled-back transactions expose neither record to the relay. Publishing before marking delivery can produce duplicates after a crash, but it does not silently lose committed work. Workers can retry after recovery, and a unique constraint or equivalent conditional write ensures that only one itinerary is committed per booking ID.

Practice Event-Driven Architecture in a full exam

Questions on Event-Driven Architecture in each practice exam, with every answer option and an explanation for each:

Start a free practice exam

What is Event-Driven Architecture

3 min read

Event-driven architecture organizes application behavior around events: records of changes or occurrences that other components may need to act on. A producer publishes an event, an intermediary transports or routes it, and one or more consumers respond. For example, an order service can publish an OrderPlaced event without directly calling every fulfillment, reporting, and notification component. Each consumer handles its own responsibility independently.

An event describes a fact, whereas a command requests an action. OrderPlaced is an event; SendReceipt is a command. Both can travel through messaging infrastructure, but using a queue does not automatically make an application event-driven. The defining idea is that components react to published occurrences rather than relying entirely on direct, coordinated calls.

Cloud implementations commonly use queues, publish-subscribe topics, and event buses. A queue buffers messages until workers can process them, helping absorb bursts and isolate producers from processing delays. Workers sharing one queue generally compete for messages; that queue does not broadcast every message to every worker. Publish-subscribe messaging distributes messages to multiple subscriptions, while an event bus routes events to targets according to rules. Separate queues for separate subscribers can combine fan-out with independent processing and failure recovery.

For service-selection questions, distinguish delivering background work from sending notifications. Amazon Simple Queue Service, or Amazon SQS, suits queued work that consumers retrieve and process. Amazon Simple Notification Service, or Amazon SNS, suits publishing messages to subscribers, including supported application endpoints and human notification channels such as email or SMS. Amazon EventBridge suits routing events from applications, AWS services, and supported external sources based on event content. These services overlap in some capabilities, but their primary purposes differ.

An operational alert illustrates how responsibilities fit together. Amazon CloudWatch evaluates a metric alarm, such as sustained high CPU utilization, and an alarm action can publish a notification to an SNS topic. Confirmed email subscribers can then receive the alert. CloudWatch performs the monitoring and alarm evaluation; SNS delivers the notification. For application-generated transactional email, such as a formatted order receipt, Amazon Simple Email Service is generally more appropriate than an SNS email subscription.

Asynchronous processing introduces trade-offs. An order may be accepted before inventory, reporting, and customer notifications finish updating, so users and downstream systems must tolerate temporary differences in state. Delivery guarantees and ordering depend on the chosen service and configuration. Many messaging paths can deliver duplicates, so consumers should be idempotent: processing the same event again must not create another charge or shipment. Configure retries, dead-letter queues where supported, and monitoring so persistent failures do not disappear unnoticed.

Reliable designs also need event identifiers, versioned schemas, correlation identifiers, appropriate access permissions, and limits on sensitive payload data. If a database update and event publication must remain consistent, use an approach such as a transactional outbox rather than assuming two separate writes succeed together. Event-driven architecture does not guarantee immediate processing, exactly-once business effects, or lower costs. It improves decoupling and independent scaling, but adds distributed tracing, failure-handling, and operational complexity; straightforward synchronous calls can remain preferable when an immediate answer is required.

Learn Event-Driven Architecture in lessons

11 short lessons on Event-Driven Architecture in 7 certification courses.

and 5 more lessons

Open the lessons