# listentolearn/aws-event-driven-architecture architecture

> Architecture diagram of the GitHub repository listentolearn/aws-event-driven-architecture, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/listentolearn/aws-event-driven-architecture
- Repository: https://github.com/listentolearn/aws-event-driven-architecture

## Overview

This repository is not an application runtime; it is a small infrastructure/policy repo for an AWS event-driven pipeline. Its purpose is to define the access and routing rules that let events move through the system safely and with loose coupling.

The target architecture described in the README is:

- Event producer: Amazon S3
- Event ingestion / topic layer: Amazon SNS
- Event buffering / stream-like handoff: Amazon SQS
- Event consumer: AWS Lambda

The main architectural idea is decoupling. S3 emits object events, but it does not talk directly to the consumer. Instead, events are published to SNS, which fans them out to one or more subscribers. SQS sits between SNS and Lambda to absorb bursts, preserve messages, and reduce direct dependency between producer and consumer availability.

The repo contains four policy artifacts that support this flow:

- `sns-access-policy.json`: permissions for publishing to or interacting with the SNS topic
- `sqs-access-policy.json`: permissions for sending to or consuming from the SQS queue
- `subscription-filter-policy.json`: SNS subscription filtering so only matching events are forwarded to a given subscription
- `lambda-policy.json`: IAM permissions for the Lambda execution role

The subscription filter policy is an important boundary in the design. It means the SNS topic can carry many event types, while each downstream queue/consumer can receive only the subset it cares about. That lets multiple consumers share the same topic without each receiving irrelevant traffic.

The SQS queue acts as the operational buffer between event ingestion and processing. This is the point where backpressure and retry behavior are handled: SNS delivers messages to SQS, and Lambda later polls or is triggered from the queue. This is what makes the system resilient to temporary consumer slowdown or failure.

The Lambda policy represents the final execution boundary. It grants the function the permissions it needs to operate in this architecture, typically including reading messages from SQS and writing logs or other AWS-side side effects. The function itself is not present in this repo; only the IAM policy needed to run it is.

There is no application business logic, database layer, or UI in this repository. The architectural scope is limited to event-routing, access control, and subscription filtering for an AWS-based asynchronous pipeline.

For an architecture diagram, the important elements to show are:
- S3 as the producer
- SNS as the central event distribution layer
- SQS as the durable handoff queue
- Lambda as the consumer
- Policy documents as the security/routing glue between those AWS services

In short: this repo defines the infrastructure permissions and subscription rules for an S3 → SNS → SQS → Lambda event-driven design, with SNS filtering and IAM policies enforcing the boundaries between components.

Main entry points: [`sns-access-policy.json`](https://github.com/listentolearn/aws-event-driven-architecture/blob/main/sns-access-policy.json) (SNS policy), [`sqs-access-policy.json`](https://github.com/listentolearn/aws-event-driven-architecture/blob/main/sqs-access-policy.json) (SQS policy), [`lambda-policy.json`](https://github.com/listentolearn/aws-event-driven-architecture/blob/main/lambda-policy.json) (Lambda policy), [`subscription-filter-policy.json`](https://github.com/listentolearn/aws-event-driven-architecture/blob/main/subscription-filter-policy.json) (Filter policy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_aws_services["AWS flow"]
  node_s3["S3<br/>event producer"]
  node_sns(("SNS<br/>event topic"))
  node_sqs["SQS<br/>buffer queue"]
  node_lambda{{"Lambda<br/>event consumer"}}
end

subgraph group_repo_policies["Repo policies"]
  node_sns_policy["SNS policy<br/>access policy"]
  node_sqs_policy["SQS policy<br/>access policy"]
  node_filter_policy["Filter policy<br/>subscription filter"]
  node_lambda_policy["Lambda policy<br/>iam policy<br/>[lambda-policy.json]"]
end

node_s3 -->|"publish events"| node_sns
node_sns -->|"fanout"| node_sqs
node_sqs -->|"trigger / poll"| node_lambda
node_filter_policy -.->|"subscription rules"| node_sns
node_sns_policy -.->|"access control"| node_sns
node_sqs_policy -.->|"access control"| node_sqs
node_lambda_policy -.->|"execution perms"| node_lambda
node_sns_policy -.->|"publish permission"| node_s3
node_sqs_policy -.->|"queue subscribe"| node_sns
node_lambda_policy -.->|"read messages"| node_sqs

click node_sns_policy "https://github.com/listentolearn/aws-event-driven-architecture/blob/main/sns-access-policy.json"
click node_sqs_policy "https://github.com/listentolearn/aws-event-driven-architecture/blob/main/sqs-access-policy.json"
click node_filter_policy "https://github.com/listentolearn/aws-event-driven-architecture/blob/main/subscription-filter-policy.json"
click node_lambda_policy "https://github.com/listentolearn/aws-event-driven-architecture/blob/main/lambda-policy.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_s3,node_sns,node_sqs,node_lambda toneBlue
class node_sns_policy,node_sqs_policy,node_filter_policy,node_lambda_policy toneAmber
```

## Components

### AWS flow

Event producer, distribution, buffering, and consumer components.

- **S3**: event producer · Emits object events that start the pipeline.
- **SNS**: event topic · Central fanout layer for incoming events.
- **SQS**: buffer queue · Durable handoff that absorbs bursts and decouples delivery.
- **Lambda**: event consumer · Downstream processor for queued events.

### Repo policies

Policy artifacts that control access and routing for the AWS event path.

- [SNS policy](https://github.com/listentolearn/aws-event-driven-architecture/blob/main/sns-access-policy.json): access policy · Permissions for publishing to or interacting with the SNS topic. · `sns-access-policy.json`
- [SQS policy](https://github.com/listentolearn/aws-event-driven-architecture/blob/main/sqs-access-policy.json): access policy · Permissions for sending to or consuming from the SQS queue. · `sqs-access-policy.json`
- [Filter policy](https://github.com/listentolearn/aws-event-driven-architecture/blob/main/subscription-filter-policy.json): subscription filter · Routes only matching SNS events to a subscription. · `subscription-filter-policy.json`
- [Lambda policy](https://github.com/listentolearn/aws-event-driven-architecture/blob/main/lambda-policy.json): iam policy · Execution-role permissions for the Lambda consumer. · `lambda-policy.json`

## Connections

- S3 → SNS: publish events · S3 object events enter the topic layer.
- SNS → SQS: fanout · SNS delivers matching notifications to the queue.
- SQS → Lambda: trigger / poll · Lambda consumes buffered messages from SQS.
- Filter policy → SNS: subscription rules · Constrains which events are forwarded to this subscription.
- SNS policy → SNS: access control · Defines permitted SNS interactions.
- SQS policy → SQS: access control · Defines permitted queue interactions.
- Lambda policy → Lambda: execution perms · Defines what the function can do when processing messages.
- SNS policy → S3: publish permission · Allows the producer side to publish into the topic.
- SQS policy → SNS: queue subscribe · Supports SNS-to-SQS delivery path.
- Lambda policy → SQS: read messages · Supports Lambda consumption from the queue.
