> For the complete documentation index, see [llms.txt](https://chris-lomeli.gitbook.io/tiny-engines/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chris-lomeli.gitbook.io/tiny-engines/walk-throughs/01-motivation/03-architecture.md).

# architecture

![](https://835605371-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MirRN1Vsv3GcZ0OdXtu%2Fsync%2F619f3ae99d4695fc45f60a24b19e7728a74012be.png?generation=1631147602955639\&alt=media)

The primary components of the solution include:

* [x] a new Bucket for ses events
* [x] Create firehose streams for each event class - each going to a separate root folder
* [x] Ingest event records from AWS and store them in S3
* [x] Transform different event records into a single flat schema
* [x] Provide the ability to join that data to our own internal data

## Data ingestion

Getting the data from AWS into our own s3 buckets is just a matter of configuration and I won't cover that part of the project.

## Inputs and outputs

The SES data format is a little different for each event class, so we are reading it into one "uber" `SES Input Schema` that brings the differences into our transformer as strings. Then, we'll transform the data into a simple flat `Required Schema` output.

* [x] [SES Input Schema](https://github.com/tiny-engines-code/tiny-engines-docs/tree/818613f91425d93f7a7f7475e056c82fea90ca52/walkthroughs/ses-transform/schema_input.md)
* [x] [Required Schema](https://github.com/tiny-engines-code/tiny-engines-docs/tree/818613f91425d93f7a7f7475e056c82fea90ca52/walkthroughs/ses-transform/schema_output.md)

## Data flow

* [x] The data is generated at AWS and pushed into Firehose delivery streams that we provide.  There's one delivery stream for each event class (e.g. Sent, Rejected, Bounced, Delivered, ...) and they are store in separate s3 folders.
* [x] We'll create an Apache Spark Structured Streaming solution to read the files, transform them and move them into a common bucket in parquet format. &#x20;
* [x] Once in parquet they can be processed and queried in AWS Athena, Redshift or Snowflake.

![](https://835605371-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MirRN1Vsv3GcZ0OdXtu%2Fsync%2Ff096c30858670b0b0eccd2955fa117138ed809a1.png?generation=1630870457138467\&alt=media)
