Event Driven Architecture (EDA) Crash Course


Hello Reader,

EDA (Event Driven Architecture) has become increasingly popular in recent times. In this newsletter edition, we will explore what is EDA , what are the benefits of EDA, and then some advanced patterns of EDA. Let's get started:

An event-driven architecture decouples the producer and processor. In this example producer (human) invokes an API, and send information in JSON payload. API Gateway puts it into an event store (SQS), and the processor (Lambda) picks it up and processes it. Note that, the API gateway and Lambda can scale (and managed/deployed) independently

Benefits of an event-driven architecture:

  1. Scale and fail independently - By decoupling your services, they are only aware of the event router, not each other. This means that your services are interoperable, but if one service has a failure, the rest will keep running. The event router acts as an elastic buffer that will accommodate surges in workloads.
  2. Develop with agility - You no longer need to write custom code to poll, filter, and route events; the event router will automatically filter and push events to consumers. The router also removes the need for heavy coordination between producer and consumer services, speeding up your development process.
  3. Audit with ease - An event router acts as a centralized location to audit your application and define policies. These policies can restrict who can publish and subscribe to a router and control which users and resources have permission to access your data. You can also encrypt your events both in transit and at rest.
  4. Cut costs - Event-driven architectures are push-based, so everything happens on-demand as the event presents itself in the router. This way, you’re not paying for continuous polling to check for an event. This means less network bandwidth consumption, less CPU utilization, less idle fleet capacity, and less SSL/TLS handshakes.

Now that we understand the EDA basics, let's take a look at a couple of advanced EDA patterns:

API Gateway + EventBridge Pattern

  1. API Gateway directly posts a message into an EventBridge event bus. Event buses are routers that receive events and delivers them to one or more targets. Event buses are well-suited for routing events from many sources to many targets, based on rules, from delivery to target.
  2. One example could be an insurance company that deals with auto, home, and boat insurance. The API is invoked by the user, which puts a message on the event bus. One field in the message determines if the message is for auto, or home, or boat insurance. EventBridge can have the rules based on the value of this field and then trigger different targets accordingly. For example, it triggers Lambda1 for auto, Step Function for home, and Lambda2 for boat insurance
  3. EventBridge can also archive the messages for testing and replay, and even transform the messages!

SNS + SQS Pattern

This pattern is similar to the previous one but has some differences:

  1. Here, SNS routes messages to different SQS queues. SNS message destination filter, or filter policy, allows subscribers to receive only a subset of messages published to a topic. This can be done using message metadata (attributes attached to the message and NOT the fields in the message), or message fields (only for SNS FIFO topics)
  2. We have separate queues for separate messages. One burning question is, why do I need the queue in between? SNS throughput can be very high and exceed the consumption rate of the processor service (Lambda or EKS in this case) causing in throttling and errors. Introducing a queue ensures that the end processor can consume the messages at a preset rate. Also, as we learned before, with SQS, retries are built in!
  3. Each queue can be processed by different targets - Lambda, EKS, and others.

If you want to know about SNS Vs SQS Vs EventBridge in detail, check out this video.

Now, you are equipped to handle even tough interview questions on EDA! Make sure to practice, and crush your cloud interview πŸ™Œ

Get 25% off the Zero to Hero with serverless

A friend of this newsletter, Yan Cui (AWS Serverless Hero), is running a serverless workshop and has kindly offered us a 25% discount!

​

Production-Ready Serverless workshop is a hands-on deep dive into everything you need to build serverless architectures for the real world β€” from system design, testing, CI/CD, cost optimizations, observability, and more. If you want to get serious about serverless and learn from one of the best, this workshop is for you. Learn more at productionreadyserverless.com. Use exclusive discount code 46JEBDF to get 25% off.

If you have found this newsletter helpful, and want to support me πŸ™:

Checkout my bestselling courses on AWS, System Design, Kubernetes, DevOps, and more: Max discounted links​

AWS SA Bootcamp with Live Classes, Mock Interviews, Hands-On, Resume Improvement and more: https://www.sabootcamp.com/​

Keep learning and keep rocking πŸš€,

Raj

Fast Track To Cloud

Free Cloud Interview Guide to crush your next interview. Plus, real-world answers for cloud interviews, and system design from a top Solutions Architect at AWS.

Read more from Fast Track To Cloud

Hello Reader, Another day, another MCP tool. But this one is special. Today we are going to go over newly released EKS MCP server. This is the official Kubernetes MCP server released and maintained by AWS. This one will rule them all! In today's edition, we are going to go over what it is, why this one is a game changer, how you can use this to get job interviews and demand more money, and whether it will eliminate SRE jobs. There are three Ways to Manage Kubernetes : Traditional Way (Manual...

Hello Reader, We all heard it - Gen AI is taking away your job. The reality is, it is for sure impacting your job functionalities. However, there is a bigger reason why many folks are failing interviews and not growing in their career, due to Gen AI, but NOT for the reasons you think! Let's dive deep You're Learning the Wrong Gen AI Tools βš™ There are countless Gen AI tools and services out there. But here’s the key question you should be asking: Which tools are actually being used by the...

Hello Reader, MCP is all the rage now. But does this make RAG obsolete? This is becoming a burning question in real-world projects and in interviews. In today's edition, let's take a closer look and find out the answer. Let's go over what is what quickly. RAG (Retrieval Augmented Generation) RAG (Retrieval Augmented Generation) is used where the response can be made better by using company specific context that the LLM does NOT have. You store relevant company data into a vector database....