# Reference implementation on AWS

> Every AWS service Sypnia AI uses in Sypnia Cloud, and how.

Applies to: Sypnia Cloud (paid service).  
Source: https://ai.docs.sypnia.com/architecture/reference-implementation-aws/

For agents: AI on AWS (us-east-1): Lambda (Rust, arm64) with response streaming behind CloudFront for ai.api.sypnia.com and mcp.ai.sypnia.com; RDS PostgreSQL (shared suite instance, schema sypnia_ai, RDS Proxy); Amazon Bedrock (InvokeModel/InvokeModelWithResponseStream, same region, IAM role; customers' Bedrock via sts:AssumeRole with external id); OpenRouter over HTTPS with Sypnia's account key in Secrets Manager; SQS (+ DLQ) for usage records to the suite's credits ledger; S3 (kept bodies and response cache, lifecycle by days, SSE-KMS with per-project data keys); KMS; EventBridge Scheduler (daily rollups, partition drops, retirement notices); CloudWatch alarms (provider error rate, time to first token, DLQ depth); spans to Sypnia Telemetry.

| Service                          | Used for                                                                                                                                              |
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| **AWS Lambda**                   | the gateway (Rust, arm64), with **response streaming** so long answers flow as they are written; one function for the API and one for MCP             |
| **Amazon CloudFront**            | `ai.api.sypnia.com` and `mcp.ai.sypnia.com`, TLS, and a first layer of protection against floods                                                      |
| **Amazon Bedrock**               | the AWS-hosted models, in the same region, through an IAM role; a customer's own Bedrock through a role in their account, assumed with an external id |
| **OpenRouter**                   | the other providers, over HTTPS, with Sypnia's account key in Secrets Manager and the zero-retention rule on every request                            |
| **RDS for PostgreSQL**           | the `sypnia_ai` schema, on the suite's shared instance, through RDS Proxy                                                                             |
| **Amazon SQS**                   | usage records on their way to the suite's credits ledger, with a dead-letter queue                                                                    |
| **Amazon S3**                    | kept questions and answers and the response cache, deleted by lifecycle rules, encrypted with KMS and a data key per project                          |
| **AWS KMS**, **Secrets Manager** | encryption keys, provider keys and your own provider keys                                                                                             |
| **EventBridge Scheduler**        | daily usage totals, dropping old days of call records, notices before a model retires                                                                 |
| **Amazon CloudWatch**            | alarms on provider error rates, time to first token and the dead-letter queue                                                                         |

Everything runs in `us-east-1`, next to the rest of Sypnia Cloud. The gateway's own traces go to Sypnia Telemetry.
