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, Happy Holidays! In today's newsletter, I am going to share three tips that helped me and many of my students switch careers to the cloud and get high-paying jobs. I will also share an update about the upcoming January cohort of the AWS SA Bootcamp. Tip 1: Leverage your IT experience Your existing IT experience is NOT throwaway. Don't think you can't reuse components of your existing knowledge in your cloud journey. For example, my student Abhisekh has deep knowledge of the...

Hello Reader, In todayโ€™s post, letโ€™s look at another correct but average answer and a great answer that gets you hired to common cloud interview questions. Question - How did you do Disaster Recovery (DR) for your AWS application? Common but average answer - I will replicate it to another region What the interviewer is looking for is how DR strategies are chosen, and what are the different strategies. As an SA, you will be responsible for talking to the app team and coming up with an...

Hello Reader, Hi from Las Vegas, USA, where I am here to present at AWS Re:Invent, the biggest cloud conference on earth. In this edition I am going to go over a BIG announcement that you should learn - Amazon EKS Autonomous Mode or EKS Auto Mode or lovingly called EKS Auto! Why is this important? Getting started with Kubernetes is hard. Sure Amazon EKS manages control plane, but you need to install core addons, select AMI, create worker node, and scale the nodes. It doesn't stop there....