It is common for companies to use or transition to microservices as a means of decoupling components and partitioning them into individual services. By breaking an application into different parts, companies can increase agility, resiliency, and scale by narrowing the scope and impact of changes made any one component to just that component.
For example, three services representing three different bounded contexts like product catalog, orders, and shipping may comprise an e-commerce application. If the product catalog service is changed, testing and validation need to occur only within that service. If the site sees an increase in orders, the order service can be scaled up independently. If a bug occurs in the shipping service, it does not impact the ability of users to browse products or place orders.
The trade-offs for reaping the benefits of a loosely coupled system is an increase in the complexity of integration between the services. A means to effectively discover, filter, and route the messages or events is necessary to connect the various services and deliver the functionality intended. Event-driven architectures, built upon managed services like Amazon EventBridge, are ideally suited to address those complexities involved in constructing systems from microservices.
Before we explore the benefits of Amazon EventBridge, let us define event-driven architectures and explore other approaches commonly used to broker events within a system.
Approaches and Benefits of EventBridge
Event-driven architectures consist of three parts: producers that create events to represent changes in state or inputs, consumers that process those events, and a communication mechanism that brokers events between them.
A standard method for system-to-system communication is via a RESTful API that uses HTTP as a cross-account transport mechanism. This approach is familiar and provides a well-known abstraction that makes it easy for implementors to distribute and respond to messages passed between the services within a system. It does have limitations around security. The HTTP integrations cannot leverage Identity and Access Management (IAM) easily and instead rely on additional services to provide authentication and management of token vending and validation.
Managed services like Amazon Simple Notification Service (SNS) and Amazon Simple Queue Service (SQS) provide another option for driving event-driven messages between microservices. These services offer a way to manage security via IAM, guarantee the delivery of event messages, and enable caching of unread event messages. AWS Lambda functions are typically employed to process, modify, and filter messages. That adds more code and points of failure into a system. Services like SNS and SQS are limited in their usefulness and application by their inability to transform events or filter topics. Depending If a on your use case requires only processing specific orders by a customer or ensuring limited access to messages, these constraints may be deal-breakers.
AWS introduced Amazon EventBridge last year to address some of the shortcomings and challenges that the previous methods had. Amazon EventBridge is a serverless event bus service that makes it easy to integrate your systems with data provided by a variety of sources. It delivers a stream of real-time data from your applications, Software-as-a-Service (SaaS) applications, and AWS services and routes that data to targets such as AWS Lambda and other services inside or external to your systems.
By configuring routing rules to determine where to send your data, you can filter and transform events and build application architectures that react in real-time to whatever events and actions your use case requires.
In the case of an e-commerce application, a customer buying a product may trigger several events during the ordering process to represent different changes or activities. Events may occur when an order is received, confirmation of payment occurs, or the product stock threshold is below a specific level. Many of these events may not apply to services consuming order service events and ultimately get ignored or filtered out. The shipping service may need to listen for a single, order complete event before generating a label and arranging transport. It can subscribe to receive EventBridge messages from the order service that only have a status of complete, thus filtering out events that do not impact the service. Additionally, that shipping service might transform the order completed event message to include shipping information or status and publish the transformed event for other consumers, such as a reporting service that provides analytics on fulfilled orders.
EventBridge simplifies the process of building event-driven architectures.
More About EventBridge
There are some drawbacks to event-driven architectures and microservices. The systems themselves are more challenging to deploy. Testing is more challenging since composing a valid, realistic test environment becomes more difficult with the number of outside integrations necessary so that the specific service under test is modeled and tested correctly. There are soft limits 1on the number of messages events per second that EventBridge can publish. This limitation can be worked around by having multiple buses within your system. Still, the additional buses necessary for proper operation adds additional overhead (both cognitive and operational) and complexity to the entire system.
Building modern applications on cloud platforms comes with different challenges and requires new approaches. Many organizations are embracing event-driven architectures as an organizing structure for the services comprising the system. Decoupling services enables independent development, operations, and scaling but increases complexity in how the services communicate with each other. Services like Amazon EventBridge provide serverless, managed solutions that make it easier to integrate your services and aggregate data coming from multiple sources. When designing your next modern application, it is worth exploring how Amazon EventBridge can help.