Looking for Senior AWS Serverless Architects & Engineers?
Let's TalkGOTO x AWS EDA Day 2024 is happening in London on May 14 and Sam Lock (aka Serverless Sam) from Serverless Guru is going!
Serverless Guru has created content related to Event Driven Architecture or EDA and we would like to share those with the community. We will cover the basics of EDA, how it works and why it is the go-to design pattern for building modern, distributed, loosely coupled, highly scalable, and asynchronous systems and applications.
We will learn how to build with EDA in AWS (Amazon Web Services). We will look at the services from the **AWS Serverless** stack and how they can be used for building EDA workloads.
We will discuss Enterprise Integration Patterns, their use cases, benefits, and possible disadvantages. We will also share practical examples and use cases of EDA in the real world.
In this blog post, we will go through some basic concepts about EDA before we dive deeper into the abyss.
What is EDA
EDA or Event Driven Architecture is a design pattern that uses events to control or manage state changes within an application or system.
The core components that make up an EDA system are:
- Producer: publishes or generates events
- Broker: routes events based on rules
- Consumer: consumes or processes events
How Does EDA Work
To explain, let’s compare it with a request-response architecture.
The request-response model uses synchronous communication between different components of the system which results in tight coupling (direct dependencies). A request is sent by a client to the service and a response must be returned.
The event driven model uses asynchronous communication (no direct dependencies) between different components of the system which enables loose coupling. An event bus or broker is where events are published by producers. Consumers subscribe to one or more events they need. The event broker manages the routing rules so it knows which events a consumer needs.
Benefits of EDA
Loose Coupling
Loose coupling removes direct dependencies between services and enables asynchronous communication.
Illustrates the difference between tightly coupled vs loosely coupled services.
Reduced Complexity
Loose coupling helps design services that are small, simple, and have a single responsibility which helps reduce the overall complexity of a system.
Evolvable Architectures
Consider the extensibility of a design or architecture. Systems change and technology continues to grow and advance. Our architecture needs to evolve and stay up to date.
Adding a new feature might require us to make adjustments to the design, but with EDA it is as simple as adding a new service to process a specific event. None of the existing components are impacted.
Scale Independently
EDA allows us to only scale the parts of the system that need it. This is huge not only for cost savings, but also for the performance of our application.
Failure Isolation
The following diagram illustrates a cascading failure, which is a problem in tightly coupled designs.
Service 1 indirectly depends on Service 3. Service 3 fails, causing Service 2 to fail as well. The failure eventually bubbles up to Service 1.
How to Build EDA
Now that we know the basics of what EDA is, we can start looking at what it takes to build an event-driven application.
Amazon Web Services (AWS) provides services that enable us to design EDA systems. The supported integrations across services grow each day. Lambda Functions, EventBridge, SQS, and Kinesis are just a few of the services that help implement EDA.
AWS Serverless allows us to deploy applications/services without worrying about managing infrastructure and lets us pay only for what we use. Serverless technologies in AWS include Lambda Functions, EventBridge, Step Functions, DynamoDB, and many more.
We will get to know some of these services so stay tuned!
Conclusion
In this short introduction, we learned about what EDA (or Event Driven Architecture) is. We compared EDA to more traditional models like Synchronous Request-Response to understand how it works and how it differs from other models. We also shared the benefits and advantages of designing systems using EDA.
Now that we understand the basics, the next blog posts in this series will introduce AWS services that are commonly used for EDA. We will also look at different integration patterns and explore the pros and cons of each.
That’s just a sneak peek of what’s to come. Stay tuned as we dive deeper into building event-driven architectures using AWS and Serverless!
EDA Resources
Building Distributed Applications with Event Driven Architecture • Eric Johnson • GOTO 2023
AWS re:Invent 2022 - Building Serverlesspresso: Creating event-driven architectures (SVS312)