Till now we have been working and understanding Lambda using our trusty calculator example code, that simply accepts few parameters and values as inputs, and, when run, provides you with some desired output. What you may not have noticed is that the inputs that we were providing for the code to run were actually part of an event, that would trigger the code into running. Similarly, you can write Lambda functions that get activated or triggered when a particular message or event is generated. This is perhaps one of the biggest reasons why I love Lambda so much and why Lambda is so much better than your traditional EC2 instances! But, before we begin exploring the various triggers and events that Lambda can respond to, let us understand what Event Driven architectures are all about and how are they so useful.
Event-driven architecture (EDA) is basically a software architecture pattern that deals with the generation, detection, consumption, and reaction to one or more events. Events can be anything; from simple messages, notification calls, to state changes. In our AWS Lambda case, events can be something such as an object getting uploaded to an S3 bucket or a row getting deleted from a DynamoDB table and so on.
An event-driven architecture in general comprises of three essential pieces: an event emitter, an event channel, and an event consumer. In simpler terms, the entire process flow looks a bit like the following image:

The event emitters are responsible for gathering state changes or events that occur within the event-driven system. They simply get the event and send it to the next step of the process which is the event channel. Here, the channels serve two purposes; one is to simply channel or funnel the event to a particular waiting consumer where the event will be processed and acted upon. Alternatively, the channel itself can react to the event, and perform some level of pre-processing on the event and then send it down to the consumers for the final processing as represented earlier.
Now, keeping these basics in mind, let us look at how AWS Lambda enables event-driven architecture along with a few easy to understand use cases as well.