Get startedGet started for free

Event-driven applications

1. Event-driven applications

By the end of this video, you will understand the principles behind building event-driven applications on AWS.

2. What is an event?

A message is a unit of work sent from one component to another for processing, using messaging systems such as Amazon SQS and SNS. An event represents the fact that something already happened inside a system. For example, an order being placed or a file uploaded. Event-driven applications focus on reacting to state changes rather than explicitly assigning work. In event-driven applications, services communicate using events. Instead of services calling each other, services publish events and other services react independently to those events. This reduces coupling between systems and improves scalability.

3. Event producers

An event producer creates and publishes events when actions occur inside an application. AWS services and custom applications can all act as event producers. For example uploading a file to S3 generates an object-created event, or an application can publish a custom event to EventBridge.

4. Event consumers

An event consumer receives and processes events asynchronously. Event sources use different delivery models. Services such as SNS and EventBridge use push-based delivery, where events are immediately delivered to targets. Services such as SQS and Kinesis use polling-based event source mappings.

5. Event source mapping

AWS Lambda is a common event consumer in AWS architectures. Lambda polls these services and retrieves batches of records automatically.

6. Tuning Lambda event source mappings

Lambda event source mappings also support operational tuning features such as batch size configuration, retry controls, and partial batch responses for supported event sources. Lambda supports `ReportBatchItemFailures`, allowing successfully processed records within a batch to avoid unnecessary retries when individual records fail. These settings help improve throughput and reduce duplicate processing.

7. Amazon EventBridge

Amazon EventBridge routes events between AWS services and applications, allowing applications to route events dynamically without tightly coupling services together. Applications publish events to EventBridge and routing rules determine which targets receive them.

8. EventBridge capabilities

EventBridge supports different routing approaches. With EventBridge Rules, one event can be sent to many targets EventBridge scheduled rules remove the need to manage traditional cron servers, supporting `rate()` and `cron()` expressions for recurring event generation. EventBridge Pipes enables point-to-point integration with filtering and transformation in between.

9. Event buses

EventBridge supports different event buses for routing events. The default event bus receives events from AWS services. Custom event buses are used for application-specific events. Partner event buses receive events from third-party providers. Rules with event patterns sit between the bus and the targets.

10. Schemas discovery

In event-driven applications, producers and consumers often evolve independently, making it important to understand event structure consistently across systems. EventBridge schema discovery can automatically identify and capture the structure of incoming events published to an event bus. Developers can use discovered schemas to inspect event payloads, validate integrations, and generate strongly typed code bindings for supported programming languages.

11. Schema registry

Amazon EventBridge Schema Registry stores event schemas so developers can understand event structure and generate code bindings.

12. Event filtering

Event filtering can reduce unnecessary processing. Use JSON event patterns to match specific events. This ensures downstream systems only process relevant events.

13. Event ordering

Event ordering is not always guaranteed. Some services may process events out of sequence unless ordering controls are explicitly configured.

14. Archiving and replaying events

EventBridge supports event archiving and replay. Archived events can later be replayed to recover from failures, test new consumers, or rebuild downstream systems.

15. Error handling

Event-driven applications must handle errors safely. Failures may include duplicate events, failed processing, and unavailable consumers. Because retries can generate duplicate events, design consumers to behave idempotently wherever possible. AWS event services automatically retry failed deliveries.

16. DLQs and destinations

Use DLQs to isolate repeatedly failing events. In EventBridge, DLQs are configured per rule target, not at the function level. Lambda Destinations extend this by routing both successful and failed asynchronous invocation results to a configurable target.

17. Testing and validating events

Testing event-driven applications focuses on validating that events are routed, filtered, retried, and processed correctly across distributed systems. AWS SAM CLI can generate sample events for every supported trigger. These commands output the exact JSON structure Lambda would receive from each service.

18. What to test

AWS SAM helps developers locally test Lambda consumers and validate event payload handling before deployment. Testing should validate event pattern matching, retry behavior, throttling scenarios, duplicate event delivery, and idempotent consumer behavior.

19. Let's practice!

Time to test your knowledge!

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.