# On AWS

> The reference implementation of Sypnia Cases on AWS, service by service.

Applies to: Sypnia Cloud (paid service).  
Source: https://cases.docs.sypnia.com/architecture/aws/

For agents: AWS: CloudFront (cases.app.sypnia.com static editor from S3; cases.api.sypnia.com and mcp.cases.sypnia.com, with their own ACM certificate, to the Lambda function URL of sypnia-cases-api; a viewer function passes the viewer's host; a Lambda@Edge function gives 401 answers their WWW-Authenticate header back), Lambda (sypnia-cases-api, Node 22, arm64, 512 MB, 30 s: the server, API and MCP, secrets read from SSM at start through CASES_SSM: database URL, the service key shared with the Data control plane, CASES_SECRET_KEY, the origin secret; a second function woken every minute by EventBridge: due review e-mails; background jobs from SQS: repository sync, link warm-up), SQS (+DLQ) for jobs, EventBridge for map.version.created, Postgres: schema cases in Sypnia's own Data database on the shared RDS, S3 for the editor, SSM/KMS for repository tokens, Sypnia Mail for e-mails. Sign-in: auth.sypnia.com (Sypnia Data). us-east-1.

| Service                            | What it does here                                                                                                                                                                                                                                                                                                                                                                                             |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **CloudFront**                     | serves the editor (`cases.app.sypnia.com`) from S3, and fronts the API (`cases.api.sypnia.com`) and MCP (`mcp.cases.sypnia.com`), which have a certificate of their own (ACM). A viewer function passes the host people used, so the server tells the API from MCP; on a `401`, a small Lambda\@Edge function gives the answer its `WWW-Authenticate` header back, which MCP clients need to start signing in |
| **S3**                             | the editor's files (exports come straight from the API)                                                                                                                                                                                                                                                                                                                                                       |
| **Lambda** (Node 22, arm64)        | the server, `sypnia-cases-api` (512 MB, 30 seconds a request): API and MCP, behind CloudFront, which adds a shared header the function checks (`CASES_ORIGIN_SECRET`). It reads its secrets from SSM when it starts; a second function, woken every minute by EventBridge, sends the review e-mails that are due and runs the other background jobs                                                           |
| **SQS** (with a dead-letter queue) | background jobs: writing a version to the repository, e-mails, warming links                                                                                                                                                                                                                                                                                                                                  |
| **EventBridge**                    | `map.version.created` and `proposal.opened` for the other products. For your app, Sypnia Run creates one bus per app environment for its cases' outcomes                                                                                                                                                                                                                                                      |
| **SQS for your cases**             | one queue per listening case (FIFO when it has `order_by`), with its dead-letter queue, created by Sypnia Run from the map ([Delivery](https://cases.docs.sypnia.com/runtime/delivery))                                                                                                                                                                                                                       |
| **Sypnia Data**                    | the `cases` schema in Sypnia's own Data database, on the shared Postgres, with a login of its own; sign-in through the Sypnia account at `auth.sypnia.com`. Cases calls Data's control plane on behalf of the person it verified, with a key the two share ([Security](https://cases.docs.sypnia.com/security))                                                                                               |
| **SSM Parameter Store and KMS**    | the server's secrets, encrypted: its database address, the key shared with Data's control plane, `CASES_SECRET_KEY` and the origin secret; repository tokens                                                                                                                                                                                                                                                  |
| **Sypnia Mail**                    | review requests and notices                                                                                                                                                                                                                                                                                                                                                                                   |

Everything runs in `us-east-1`, next to the other Sypnia products, so links between products stay inside one region.
