The Secret Life of AWS: The Central Nervous System (Amazon EventBridge)
The Secret Life of AWS: The Central Nervous System (Amazon EventBridge)
How to route complex events and integrate third-party data without writing code
#AWS #EventBridge #Microservices #EventDriven
🎧 Audio Edition: Prefer to listen? Check out the expanded AI podcast version of this deep dive on YouTube.
📺 Video Edition: Prefer to watch? Check out the 7-minute visual explainer on YouTube.
Part 48 of The Secret Life of AWS
Timothy was staring at his architecture diagram. The SNS-to-SQS fanout was working perfectly for the Checkout service. But now, the business was introducing a third-party payment processor. This external SaaS provider sent webhook events every time a transaction cleared, failed, or was flagged for fraud.
Timothy mapped out a solution. "I will build an Amazon API Gateway," he explained to Margaret. "It will receive the webhook from the payment provider, trigger a Lambda function to parse the JSON, and then that Lambda will publish the event to a new SNS Topic. Then, I will subscribe our internal queues to that topic."
Margaret picked up a red marker and crossed out the API Gateway, the Lambda function, and the SNS Topic.
"You are building custom infrastructure just to catch data and pass it along," Margaret said. "Think of SNS as your everyday broadcast system. It is perfect when you need to notify multiple services about an event, and simple attribute filtering is enough. But it only filters based on message headers, not the actual content of the payload. We need a system that can inspect the data and make intelligent routing decisions."
"We need an Event Bus," she continued. "We are upgrading to Amazon EventBridge."
The Event Bus
Margaret opened the AWS Console and navigated to Amazon EventBridge.
"An event bus is the central nervous system of an event-driven architecture," Margaret explained. "Every AWS account comes with a Default Event Bus, which automatically receives events from AWS services—like when an EC2 instance changes state. But we are going to create a Custom Event Bus for our internal application events."
She typed checkout-application-bus and clicked create.
"Now," Margaret said, pointing to the external payment provider on Timothy's diagram, "we do not need to build an API Gateway to receive their webhooks. EventBridge supports Partner Event Sources. Many major SaaS providers like Datadog, Zendesk, and Stripe can drop events directly into an EventBridge bus in your AWS account securely, with zero custom integration code."
"EventBridge adds a small cost per million events," she noted, "but the reduction in custom Lambda compute time and API Gateway infrastructure often makes it a net savings. More importantly, it removes the operational burden of maintaining that glue code."
Intelligence at the Routing Layer (Rules)
"But once the event is on the bus, how does it know where to go?" Timothy asked. "With SNS, we just pushed it to everyone who subscribed."
"With EventBridge, the intelligence lives in the Rules," Margaret replied.
She created a new Rule attached to the custom bus. "EventBridge looks deeply into the actual JSON payload of the event. Let's say we want to isolate fraudulent transactions."
She wrote a quick Event Pattern in JSON:
{
"source": ["payment.provider"],
"detail-type": ["Transaction Status"],
"detail": {
"status": ["failed"],
"fraud_score": [{ "numeric": [ ">", 90 ] }]
}
}
"This rule inspects the event," Margaret explained. "It doesn't just look at headers. It looks inside the detail object. If the transaction failed and the numeric fraud score is greater than 90, this rule catches it. If the score is 89, it ignores it. You no longer have to write custom Python or Node.js code in a Lambda function just to write if/else routing statements. The network does the logic."
Direct Targets and Resilience
"Where does the rule send it?" Timothy asked.
"Almost anywhere," Margaret smiled. "SNS can only natively target a few services, like SQS, Lambda, and HTTP endpoints. EventBridge can route directly to over 35 AWS services."
She configured the Rule's target to point directly to an AWS Step Functions state machine designed by the security team.
"If an event matches the fraud rule, EventBridge triggers the security workflow directly," she said. "We can create a second rule for successful payments that targets our fulfillment-queue in SQS. We can create a third rule that sends all data to Amazon Kinesis for analytics."
Timothy thought about the failure scenarios they had discussed in the past. "What if the security workflow is down, and EventBridge cannot deliver the event?"
"Just like our queues, EventBridge supports a Dead-Letter Queue (DLQ)," Margaret reassured him. "If a rule cannot deliver an event because the target is broken or permissions are misconfigured, it sends it to an SQS queue for later inspection. And if something goes catastrophically wrong with our downstream processing, EventBridge can Archive all events and Replay them later, which is an absolute lifesaver for debugging or backfilling data."
The Schema Registry
Timothy looked at the configuration. "This is incredibly powerful. But if we have dozens of microservices and third-party SaaS apps all dropping different JSON payloads onto the bus, how do our developers know what those events look like? How do they know what fields to filter on?"
"That is the hallmark of a mature event-driven architecture," Margaret noted. "EventBridge includes a Schema Registry. You can turn on Schema Discovery, and EventBridge will automatically analyze the events flowing through the bus, deduce their JSON schema, and store it. Developers can browse the registry and even download code bindings to strongly type those events in their applications."
Timothy erased the API Gateway and the custom Lambda function from his whiteboard. He drew a single pipeline directly from the SaaS provider into the Event Bus, branching out cleanly to his microservices.
The architecture wasn't just decoupled anymore. It was intelligent.
Key Concepts
Amazon EventBridge is a serverless event bus that acts as the central router for an event-driven architecture, making it easy to connect applications using data generated from your own systems, integrated SaaS applications, and AWS services.
Unlike a simple broadcast mechanism, an Event Bus acts as an intelligent pipeline that receives events and delivers them to precise destinations based on deep content inspection.
One of its most powerful features is Partner Event Sources, which allows direct and secure integration with third-party SaaS platforms without the need to build, secure, or maintain custom webhook-receiving infrastructure like API Gateways.
The routing logic is handled by EventBridge Rules, which evaluate incoming events based on their structure or payload content.
This enables Content-Based Filtering, allowing architects to route events by deeply inspecting the JSON payload for specific strings, numeric ranges, or logic operators, shifting the routing burden from application code to the AWS network itself.
To ensure resilience, EventBridge supports Archive and Replay, allowing you to store a historical record of events and re-process them if downstream systems fail or need to be backfilled.
Failed deliveries can also be routed to a Dead-Letter Queue (DLQ) for manual inspection.
Finally, the Schema Registry solves the discoverability problem in large architectures by automatically analyzing and recording the structure of events flowing through the bus, allowing developers to easily understand and integrate with complex event payloads.
Aaron Rose is a software engineer and technology writer at tech-reader.blog. For explainer videos and podcasts, check out Tech-Reader YouTube channel.
.jpg)

Comments
Post a Comment