Skip to content

A reference implementation on AWS, service by service

Every AWS service the engine uses, what it does, which part of the engine runs in it and whether that part is Rust or a managed service; a request traced through the real services; the template; and the cost model with its arithmetic, down to what one small project adds.

Applies to EngineCloud
View as Markdown
On this page
  1. The services
  2. Where the Rust is, and where the logic is
  3. From crates to functions to services
  4. One request through the real services
  5. Limits and settings in one place
  6. The template
  7. Postgres: which one, and why
  8. The cost model
  9. Prices used
  10. An idle deployment
  11. Unit costs
  12. Two self-hosted examples
  13. One small project, at its usage
  14. What changed from the system this comes from
  15. Next

Deployment shapes says the engine can run as functions on AWS. This page is that deployment with the names on: which AWS service does what, where the Rust code runs, where the engine’s logic lives, what each service is limited to, and what it costs. It is the deployment the templates sypnia-db.yaml and sypnia-aws.yaml create, and the one Sypnia Cloud runs Cloud.

The services

Nine AWS services. One of them, Lambda, runs the engine’s code, as three functions. The last column is the answer to «is this Rust, or is this Amazon?».

AWS serviceWhat it does hereWhich part of the engineRust code, or managed
Amazon CloudFrontThe one HTTPS address. Sends /v1/ingest/*, /v1/otlp/* and the SDK’s two script files (/v1/sdk.js, /v1/sdk-recorder.js) to the ingest function and everything else to the API function. Caches only those two filesNone. It forwardsManaged. Configuration: four path rules
AWS Lambda, function sypnia-ingestReceives what SDKs sendIngest: the seven gates, then the batch goes to the queue; replay chunks and snapshots go to the BucketRust: the sypnia binary with SYPNIA_ROLE=ingest
AWS Lambda, function sypnia-workerDoes all the work that is not a requestThe worker: writing segments, the Fast path, the Roll-up, the agent’s jobs, Alerts and webhooks, uptime checks, retention, ParquetRust: the same binary with SYPNIA_ROLE=worker
AWS Lambda, function sypnia-apiAnswers people and coding agentsThe API, the MCP server and the ConsoleRust: the same binary with SYPNIA_ROLE=api
Amazon SQS, the intake queue and its dead-letter queueHolds validated batches until the worker has written them; parks the ones that failed five timesNone. It is the buffer a function cannot keep in memoryManaged. Configuration: retention, visibility timeout, maxReceiveCount
Amazon EventBridge SchedulerWakes the worker every minuteNone. The worker decides what is dueManaged. Configuration: rate(1 minute)
Amazon S3The Bucket: segments, per-session files, replay chunks, snapshots, source maps, ParquetNone. Keys are built by the engine; retention is the engine’s daily jobManaged. Configuration: private, encrypted, one rule for unfinished uploads, CORS for replay links
Amazon RDS for PostgreSQLPostgres: the ledger, problems, numbers, the session index, alerts, jobs. One instance in a stack of its own, sypnia-db; the engine has its own database and role in itNone. No stored procedure, no trigger, no extensionManaged. Or any Postgres 15 or later of yours
AWS Systems Manager Parameter StoreHolds the database passwords as SecureStrings: the instance’s master password and the engine’s ownNoneManaged. Standard parameters
Amazon CloudWatchA log group per function, kept 30 days; three alarmsNone. The alarms watch the engine from outsideManaged. Configuration: three thresholds
AWS IAMOne role per function, each with the least it needsNoneManaged

Not used, on purpose: no load balancer, no API gateway, no container cluster, no NAT gateway, no stream, no cache, no search service, no workflow service, no second database.

Cloud Sypnia Cloud serves its MCP server at the root of mcp.sypnia.com, not at /mcp. The same distribution carries mcp.sypnia.com as an alternate domain name, and one CloudFront Function on its default behaviour (viewer request) rewrites / on that host to /mcp, so the request reaches sypnia-api as on any engine; nothing else is rewritten, so /.well-known/… at the root stays free. The function runs on the API’s requests only, at USD 0.10 per million.

The Sypnia engine and Sypnia Cloud compared
Sypnia engineOpen source, self-hostedSypnia CloudPaid service, with a free tier
E-mailNone. Alerts are recorded and sent to your webhook; the guides show how to send e-mail from it.Amazon SES: alert e-mails and the daily summary.
AI providerYours, off until you set a key. The worker calls it over HTTPS.OpenRouter, with settings that forbid providers from keeping or training on the data.
Accounts, billing, the app, the GitHub AppNot in the engine.The private app. It is a client of the engine's public API, like your own tools; it has its own database and adds no logic to the engine.

Where the Rust is, and where the logic is

Figure. The reference implementation. The three lit boxes are the engine: one Rust binary, three roles. Everything else is a managed service that moves or holds bytes.
  1. Amazon CloudFront is the address. It sends /v1/ingest/*, /v1/otlp/*, /v1/sdk.js and /v1/sdk-recorder.js to sypnia-ingest, and everything else to sypnia-api.
  2. sypnia-ingest (AWS Lambda, 256 MB, 10 s, 40 copies) is Ingest: the seven gates. It sends each batch to the queue, and replay chunks and snapshots straight to S3.
  3. Amazon SQS holds the intake queue and, after 5 deliveries, the dead-letter queue (14 days).
  4. sypnia-worker (1,024 MB, 15 min, 3 copies) writes segments and runs the Fast path, the Roll-up, the agent, alerts, uptime and retention. It invokes itself for agent jobs.
  5. Amazon EventBridge Scheduler wakes the worker every minute.
  6. Amazon S3 is the Bucket.
  7. Amazon RDS for PostgreSQL is Postgres, in its own stack, sypnia-db.
  8. sypnia-api (512 MB, 30 s, 20 copies) is the API, the MCP server and the Console. It reads Postgres and signs links to S3.
Read this diagram as text

Inside the frame «AWS account · us-east-1 · stack: sypnia» the three Lambda functions are lit and tagged «Rust»: they are the engine. Everything else is a managed service. Your app (SDK) reaches sypnia-ingest through CloudFront; you, your coding agent and your CI reach sypnia-api the same way. Ingest calls SendMessage; the queue delivers up to 10 seconds of messages to the worker; the worker writes segments, session files and Parquet to S3, and the ledger, problems, numbers and jobs to Postgres. Around it: AWS Systems Manager Parameter Store (the database passwords), Amazon CloudWatch (logs and 3 alarms) and AWS IAM (one role per function). Outside the frame, the worker calls the AI provider (yours; on Sypnia Cloud, OpenRouter) and your webhook. Sypnia Cloud only: Amazon SES and the private app.

Three statements, each of which you can check in the template and in the code:

  1. Everything inside the three functions is the engine, and the engine is Rust. The functions run the same file, sypnia, built for arm64 and started by Lambda as its bootstrap. There is no Node, Python or Java runtime in the deployment, and no second program.
  2. AWS services move and hold bytes. CloudFront forwards a request. SQS keeps a message. S3 keeps an object. Postgres keeps rows. The scheduler sends one fixed JSON document a minute. None of them inspects an event.
  3. No logic lives in a service’s configuration. What the template configures is numbers and names: four path rules, a retention, a visibility timeout, the 5 of the dead-letter rule, a rate, three alarm thresholds, the roles. There is no request-mapping template, no rule with a filter, no code at the edge, no bucket notification, no stored procedure, no trigger, no workflow definition. Retention is not even a bucket lifecycle rule: it is the engine’s daily job, so it is the same on any S3-compatible store.

That third statement is what makes the engine portable. Replace SQS by memory and Lambda by a process, and you have the one-process shape, with the same code deciding the same things.

From crates to functions to services

Figure. Which crate runs in which function, and which service each function may touch. The left column holds all the logic.
  1. The crates: all the logic. The binary crate sypnia (main, lambda, Engine) becomes all three functions through main → lambda::run(role); sypnia-store, sypnia-db, sypnia-fingerprint and sypnia-core are linked into all three.
  2. The functions: the same binary, started with SYPNIA_ROLE=ingest, worker or api.
  3. The AWS services, and on each one the permission of the function that touches it.
Read this diagram as text

Which crate runs where: sypnia-ingest runs in the ingest function (the gates, the send) and in the worker (the queue’s other end: writing segments); sypnia-pipeline and sypnia-alerts run in the worker; sypnia-agent runs in the worker (jobs) and in the API (the prompt); sypnia-api runs in the API function. What each function may touch: the ingest function is invoked by CloudFront, may send to SQS and may only put to S3. The worker receives, deletes and delays SQS messages, is woken by the Scheduler every minute, reads and writes S3 and RDS, and calls the AI provider and your webhook. The API function is invoked by CloudFront, reads RDS and makes the writes of the API, and reads S3 and signs links. The left column is all the logic; the right column has none.

CrateRuns inReaches
sypnia (the binary): main, lambda, EngineAll three functionsThe Lambda runtime
sypnia-ingestsypnia-ingest: the gates and the send. sypnia-worker: the queue’s other end, which writes segmentsSQS, S3
sypnia-pipelinesypnia-workerS3, Postgres
sypnia-agentsypnia-worker: the jobs. sypnia-api: the promptS3, Postgres, the AI provider
sypnia-alertssypnia-workerPostgres, your webhook, the addresses of your uptime checks
sypnia-apisypnia-apiPostgres, S3 (read, and signing links)
sypnia-store, sypnia-dbAll threeS3; Postgres
sypnia-fingerprint, sypnia-coreAll threeNothing: no I/O

The functions share one entry point. It is the main of Deployment shapes; these are the lines that matter here. Notice that the role is the only thing that differs between the three functions, and that it is read from the environment the template sets.

crates/sypnia/src/main.rs
    // Bucket, Postgres, the AI provider (or none), the alert sinks. Built once, shared by everything.
    let engine = match Engine::connect(config.clone()).await {
        Ok(engine) => Arc::new(engine),
        Err(error) => return fail(4, &error),
    };

    // Inside AWS Lambda the runtime sets this variable and there is no command line.
    if std::env::var_os("AWS_LAMBDA_RUNTIME_API").is_some() {
        return exit(lambda::run(engine, config.role).await); // SYPNIA_ROLE: ingest | worker | api
    }

One request through the real services

The failed payment of the overview, with the service that carries each step, its time budget, its limit and what happens when that service fails. The failure column is a summary; What happens when something fails has every case.

#StepServiceBudgetThe limit that appliesIf it fails
1The browser sends POST /v1/ingest/eventsCloudFront → Lambda sypnia-ingest50 ms warm; 300 ms for a cold functionBody: 2 MiB after decompression (the engine’s), 6 MB (Lambda’s). 10 s. 40 copies; beyond them the address answers 429The SDK keeps the batch and retries with the same batch_id
2Ingest sends the validated batchSQS SendMessage20 ms256 KiB a message; a batch over 192 KiB compressed goes to S3 and the message names it503; the SDK retries
3Ingest answers 200Lambda → CloudFront———
4The queue hands the batch to the workerSQS → Lambda sypnia-workerUp to 10 s500 messages or 6 MB a delivery. At most 2 copies at once. Visibility 15 minDelivered again after 15 s, 1 min, 5 min, 15 min; then the dead-letter queue
5The worker writes the segmentS3 PutObject300 ms4 MiB a segment, before compressionThe message is not deleted; step 4 repeats
6The worker writes the ledger row, scans the segment, writes the problem, its alert and its jobRDS for PostgreSQL, one transaction50 ms; 5 s for the scan3 connections per worker copyThe segment stays leased 2 minutes, then another try; 5 tries, then quarantine
7The worker calls itself with the jobLambda Invoke, asynchronous100 msLambda’s own retries off: the job row is the retryThe minute tick finds the row
8The agent reads maps and the session, calls the model, writes the sentenceS3 GetObject; HTTPS to the AI provider; Postgres60 s15 min for the function; 3 tries for the jobThe alert leaves on time without the sentence; analysis.status: failed
9The alert is released to your webhookHTTPS from the worker10 s7 tries over 21 hoursThe alert is recorded all the same
10Every minute: one passEventBridge Scheduler → Lambda sypnia-worker1 s when idle3 copies shared with steps 4, 7 and 8; the queue never takes the thirdThe next tick does it
11Your coding agent calls the MCP tool problemCloudFront → Lambda sypnia-api → Postgres300 msAnswer: 6 MB (Lambda’s); 30 s; 20 copies; 2 connections per copy503 with Retry-After: 2
12You open the replaysypnia-api signs links; the browser reads S3 directly300 ms for the linksA link lives 15 minutes; chunks never pass through a function503; the list of problems still works

Limits and settings in one place

WhereSettingValueWhy this value
sypnia-ingestMemory, time limit, copies256 MB, 10 s, 40It only checks and forwards. 40 copies at 50 ms accept about 800 batches a second
sypnia-workerMemory, time limit, copies1,024 MB, 15 min, 3Two projects rolled at once (2 × 256 MB), the source-map cache, room. The daily job may need the 15 minutes. The queue may use 2 copies, so the third is always there for the minute tick and agent jobs
sypnia-apiMemory, time limit, copies512 MB, 30 s, 20A session’s detail is built in memory, inside a 4 MB budget
All functionsArchitecture, runtimearm64, provided.al2023A native binary; no language runtime to start
All functionsEnvironmentUnder 4 KB in allLambda’s limit. The engine needs about 12 settings
Intake queueRetention, visibility, deliveries4 days, 15 min, 5See Reliability
Dead-letter queueRetention14 daysThe longest SQS allows
Queue → workerBatch, window, answer500 messages or 6 MB, 10 s, failures reported per messageOne bad message does not send the others back
SchedulerRateEvery minuteOne schedule; daily and weekly work is started by the pass when due
BucketEncryption, accessAt rest, privateFunctions reach it through their roles; browsers through 15-minute signed links
PostgresConnectionsAt most 89: 40 × 1, 20 × 2, 3 × 3Fits the smallest instance, which accepts about 100, with about 10 left for db-init and anything else on the instance
AlarmsThreeDead-letter queue not empty; oldest message over 120 s for 3 minutes; worker failing in 3 of 5 minutesThey work when the engine does not

The three copies of the worker are shared by the queue’s deliveries, the minute tick and agent jobs. The queue may use at most two of them (MaximumConcurrency: 2, the lowest SQS allows), so a burst of deliveries never holds back the minute tick. When all are busy, a new call waits: a message stays in the queue, an asynchronous call is held by Lambda. Nothing is lost; work is later. This is the first number to raise when lag_seconds grows, together with the database’s connections.

The template

The whole engine is one file, sypnia-aws.yaml, beside the database’s, sypnia-db.yaml. This excerpt is the part this page talks about: the three functions, the queue with its dead-letter rule, the schedule and one alarm. Left out: the distribution, the bucket, the roles written out one by one, the log groups, the other two alarms and the outputs. Names carry the stack’s name, so a development and a production stack fit one account. How to deploy it is in Deploy on AWS.

deploy/sypnia-aws.yaml (excerpt)
Transform: AWS::Serverless-2016-10-31

Globals:
  Function:
    Runtime: provided.al2023          # no language runtime: the package is the sypnia binary, named bootstrap
    Handler: bootstrap
    Architectures: [arm64]
    CodeUri: { Bucket: !Ref CodeBucket, Key: !Sub "sypnia/${Version}/sypnia-lambda-arm64.zip" }
    Environment:
      Variables:
        SYPNIA_ROOT_TOKEN: !Ref RootToken
        SYPNIA_STORAGE_BUCKET: !Ref Bucket
        SYPNIA_DATABASE_URL: !If                  # the instance of the sypnia-db stack, or a Postgres of yours
          - SharedDb
          - !Sub
            - "postgres://${DatabaseUser}:${DatabasePassword}@${Host}:5432/${DatabaseName}?sslmode=require"
            - Host: { "Fn::ImportValue": !Sub "${DatabaseStack}-Host" }
          - !Ref DatabaseUrl
        SYPNIA_INTAKE_QUEUE_URL: !Ref IntakeQueue                       # the queue stands in for the in-memory buffer
        SYPNIA_INTAKE_DEAD_LETTER_QUEUE_URL: !Ref IntakeDeadLetterQueue # read by /v1/engine/status and sypnia doctor

Resources:
  IngestFunction:
    Type: AWS::Serverless::Function
    Properties:
      FunctionName: !Sub "${AWS::StackName}-ingest"
      MemorySize: 256
      Timeout: 10
      ReservedConcurrentExecutions: 40
      FunctionUrlConfig: { AuthType: NONE }   # reached through the distribution; the engine checks every key itself
      Environment: { Variables: { SYPNIA_ROLE: ingest, SYPNIA_DATABASE_MAX_CONNECTIONS: "1" } }
      Role: !GetAtt IngestRole.Arn            # send to the queue, put objects; written out, not a SAM shortcut

  ApiFunction:
    Type: AWS::Serverless::Function
    Properties:
      FunctionName: !Sub "${AWS::StackName}-api"
      MemorySize: 512
      Timeout: 30
      ReservedConcurrentExecutions: 20
      FunctionUrlConfig: { AuthType: NONE }
      Environment: { Variables: { SYPNIA_ROLE: api, SYPNIA_DATABASE_MAX_CONNECTIONS: "2" } }
      Role: !GetAtt ApiRole.Arn               # read, and sign links to read and to upload source maps

  WorkerFunction:
    Type: AWS::Serverless::Function
    Properties:
      FunctionName: !Sub "${AWS::StackName}-worker"
      MemorySize: 1024
      Timeout: 900
      ReservedConcurrentExecutions: 3                                   # the queue takes at most 2; the tick always has one
      Environment: { Variables: { SYPNIA_ROLE: worker, SYPNIA_DATABASE_MAX_CONNECTIONS: "3", SYPNIA_AUTO_MIGRATE: "true" } }
      EventInvokeConfig: { MaximumRetryAttempts: 0 }                    # a job is a row in Postgres: the row is the retry
      Role: !GetAtt WorkerRole.Arn            # the bucket, both queues, invoking itself
      Events:
        Intake:
          Type: SQS
          Properties:
            Queue: !GetAtt IntakeQueue.Arn
            BatchSize: 500
            MaximumBatchingWindowInSeconds: 10
            FunctionResponseTypes: [ReportBatchItemFailures]             # only the messages that failed come back
            ScalingConfig: { MaximumConcurrency: 2 }
        EveryMinute:
          Type: ScheduleV2
          Properties:
            ScheduleExpression: rate(1 minute)
            Input: '{"job":"pass"}'

  IntakeQueue:
    Type: AWS::SQS::Queue
    Properties:
      VisibilityTimeout: 900                  # not shorter than the worker's time limit
      MessageRetentionPeriod: 345600          # 4 days
      ReceiveMessageWaitTimeSeconds: 20
      SqsManagedSseEnabled: true
      RedrivePolicy:
        deadLetterTargetArn: !GetAtt IntakeDeadLetterQueue.Arn
        maxReceiveCount: 5                    # the fifth failed delivery is the last

  IntakeDeadLetterQueue:
    Type: AWS::SQS::Queue
    Properties:
      MessageRetentionPeriod: 1209600         # 14 days
      SqsManagedSseEnabled: true

  DeadLetterNotEmpty:
    Type: AWS::CloudWatch::Alarm
    Properties:
      AlarmDescription: Batches were set aside. Look at one, fix the cause, redrive.
      Namespace: AWS/SQS
      MetricName: ApproximateNumberOfMessagesVisible
      Dimensions: [{ Name: QueueName, Value: !GetAtt IntakeDeadLetterQueue.QueueName }]
      Statistic: Maximum
      Period: 60
      EvaluationPeriods: 1
      Threshold: 0
      ComparisonOperator: GreaterThanThreshold
      TreatMissingData: notBreaching

What wakes the worker is told apart by the shape of the event, in worker_event of Deployment shapes: { "Records": […] } is the queue, { "job": "pass" } is the schedule, { "job": { "agent": { "problem": "prb_8f3k2m9x4q7w" } } } is the worker calling itself.

Postgres: which one, and why

The reference uses Amazon RDS for PostgreSQL, one small instance in one availability zone, in a stack of its own: sypnia-db.yaml, stack sypnia-db. db.t4g.micro, Postgres 16, 20 GB of gp3 that grows by itself up to 100 GB, encrypted, TLS forced (rds.force_ssl), backups kept 7 days, deletion protection on, a snapshot when the stack is deleted.

  • Its own stack, so the engine stack can be deleted and created again while the data stays.
  • One instance, several databases. The engine gets its own database, sypnia, and its own role, sypnia_engine, which owns that database and nothing else; scripts/deploy-aws.sh db-init creates both with the master user, which nothing else uses. Another application gets its own database and role on the same instance, not a second instance.
  • When it runs short, resize it to db.t4g.small: a change of instance class, with no migration.
  • Bring your own with the engine stack’s DatabaseUrl; then the database stack is not needed.
OptionIdle cost a monthGoodThe price you pay
RDS for PostgreSQL, db.t4g.micro (the reference)11.68 + 2.30 of diskThe cheapest managed Postgres on AWS; a fixed bill; plain PostgresOne zone: a failure of the instance is minutes of «receiving works, reading does not». About 100 connections
RDS, two zones (Multi-AZ)Twice the instance and the diskFails over by itself in a minute or twoTwice the price for a database the Bucket can mostly rebuild
Aurora Serverless v2From 43.80: 0.5 capacity units × 0.12 × 730, plus storage and I/OGrows and shrinks with loadThree times the idle cost. Scaling to zero does not fit: the minute tick would wake it every minute
A Postgres outside AWS (Supabase, Neon, your own)0 to 25You may already have itEvery query crosses the internet; their connection limits apply. Use a session-mode or direct connection, not a transaction pooler

One connection string. The engine takes a single SYPNIA_DATABASE_URL, for every role. It must be a direct or session-mode connection: the engine prepares its statements and runs transactions of several statements, which a transaction-mode pooler breaks. Functions keep the total small instead: 1 connection per ingest copy, 2 per API copy, 3 per worker copy.

Secrets. The database passwords are SSM Parameter Store SecureStrings, not Secrets Manager secrets: /sypnia/db/master-password and /sypnia/engine/db-password. CloudFormation cannot create a SecureString, so scripts/deploy-aws.sh db-secrets does, with 48 generated hex characters written through a file only you can read and never printed. The database stack reads the master password with a {{resolve:ssm-secure:…}} reference, one of the few properties where CloudFormation allows it. A Lambda environment is not one of them, so scripts/deploy-aws.sh deploy reads the engine’s password from SSM and hands it to the engine stack’s parameter DatabasePassword, which is never echoed. db-init passes passwords to psql through its environment, never on a command line. The engine’s password, the root token, the AI key and the webhook secret end up in the functions’ environment, which Lambda encrypts at rest. Anyone who may read a function’s configuration can read them; restrict that permission as you would restrict the secrets themselves.

The cost model

Prices used

USD, on demand, us-east-1, as assumed on 2026-11-15, without any free allowance. Each name links to the official price list.

ServiceUnitPrice
AWS Lambda, arm64Per GB-second; per million requests0.0000133334; 0.20
Amazon SQS, standardPer million requests (each 64 KB of a message is one)0.40
Amazon S3, StandardPer GB-month; per million writes or lists; per million reads0.023; 5.00; 0.40
Amazon CloudFrontPer million HTTPS requests; per GB sent to the function; per GB sent out1.00; 0.02; 0.085
Data leaving AWS from S3Per GB0.09
Amazon RDS for PostgreSQLdb.t4g.micro per hour; db.t4g.medium per hour; disk per GB-month; a public address per hour0.016; 0.065; 0.115; 0.005
Amazon EventBridge SchedulerPer million invocations1.00
Amazon CloudWatchLogs per GB; per alarm a month0.50; 0.10
AWS Systems Manager Parameter StoreA standard parameter, SecureString included0.00
Amazon SES CloudPer 1,000 e-mails0.10
NAT gateway (not in the reference)Per hour; per GB0.045; 0.045

AWS gives every account a monthly allowance that covers a small deployment’s functions (400,000 GB-seconds and a million requests), its queue (a million requests) and its address (10 million requests). The unit costs below ignore it, so they stay true at any size.

An idle deployment

Nothing arrives. What still costs:

LineArithmeticA month
The minute tick43,200 calls × 1 s × 1 GB × 0.0000133334, plus 43,200 × 0.20 ÷ 1,000,0000.59
The schedule43,200 × 1.00 ÷ 1,000,0000.04
The queue’s empty pollsAbout 15 a minute: 648,000 × 0.40 ÷ 1,000,0000.26
Three alarms3 × 0.100.30
Two SecureStringsStandard parameters0.00
LogsAbout 0.1 GB0.05
Bucket, address, the other two functionsNothing arrives, nothing is billed0.00
The engine, idle≈ 1.24
Postgres, the sypnia-db stack0.016 × 730 + 20 × 0.11513.98
Its public address0.005 × 7303.65
Total, idle≈ 18.87

With a Postgres you already have, an idle engine is under USD 2 a month, and with the free allowance it is cents.

Unit costs

Receiving, storing and processing events. The unit that costs is not the event: it is the batch, and the segment it lands in.

Step, per 1,000 batchesServiceArithmeticUSD
The address receives themCloudFront1,000 × 1.00 ÷ 1,000,0000.00100
The bodies reach the function, 3 KB eachCloudFront0.003 GB × 0.020.00006
sypnia-ingest is calledLambda1,000 × 0.20 ÷ 1,000,0000.00020
It runs 50 ms at 256 MBLambda12.5 GB-s × 0.00001333340.00017
The batches are sent to the queueSQS1,000 × 0.40 ÷ 1,000,0000.00040
The worker receives and deletes them, in groupsSQSAbout 670 requests × 0.40 ÷ 1,000,0000.00027
Receiving0.0021
Segments written: at most one per batchS31,000 × 5.00 ÷ 1,000,0000.00500
Each read once by the fast path and up to 11 times by the roll-upS312,000 × 0.40 ÷ 1,000,0000.00480
The worker’s time for them, 20 ms each at 1 GBLambda20 GB-s × 0.00001333340.00027
Storing and processing, at most0.0101
Total, at most0.0122

Segments are the larger half, and they are capped: a project and environment gets at most one segment per 10-second delivery, 259,200 a month, however much it sends. So the cost of a million events depends on how they arrive:

A million eventsBatchesSegmentsArithmeticUSD
A busy project: the small project of Deployment shapes, 4 million events a month225,00065,000 (the cap, shared by 4 million)225 × 0.0021 + 65 × 0.0101 + 15,000 session files × 5 ÷ 1,000,000≈ 1.20
A quiet project: every batch alone in its 10 seconds225,000225,000225 × 0.0122 + 0.08≈ 2.80
The worst shape: every event alone in a batch, two events a session1,000,0001,000,0001,000 × 0.0122 + 1,000,000 session files × 5 ÷ 1,000,000≈ 17.20

Measured on the system this engine comes from: 4.4 events a batch and 30 batches a session, which is where 225,000 comes from. The worst shape is what a hard limit must assume, and what nobody’s app looks like.

Storing. USD 0.023 per GB-month. A GB is about 8 million events as segments (125 MB a million), or 2.7 million with their per-session files and Parquet (375 MB a million), or about 1,330 short replays.

Replays. A recording is one object per 10 seconds, sent through the address and sypnia-ingest, and read by the browser straight from S3 when someone watches it.

Per 1,000 replaysA short one: 22 chunks, 0.75 MB (measured there)The longest: 720 chunks, 144 MB, two hours
Requests through the address and the function22,000 × (1.00 + 0.20 + 0.33) ÷ 1,000,000 = 0.0341.10
Bodies to the function0.75 GB × 0.02 = 0.0152.88
Objects written22,000 × 5 ÷ 1,000,000 = 0.1103.60
Stored≈ 0.16≈ 7.58
Kept, per month of retention0.75 GB × 0.023 = 0.0173.31
Watched once, each of them22,000 reads × 0.40 ÷ 1,000,000 + 0.75 GB × 0.09 = 0.076≈ 13.25

A short replay costs two hundredths of a cent to store and watch. The longest costs two cents, almost 90 times more, and most of that is the data leaving AWS when it is watched.

An AI analysis. The engine counts tokens, not money; the price is your provider’s. The formula:

Text
cost = calls × (tokens_in × price_in + tokens_out × price_out) ÷ 1,000,000
Tokens inTokens outCalls
A usual analysis8,000: about 24,000 characters of context at 3 to 4 characters a token, plus the fixed instructions7001.15: assumed, one answer in seven fails the check and is asked again
The largest the engine allows9,0002,000 (ai.max_output_tokens)3
Price of the model, per million tokens in / outA usual analysisThe largest
0.15 / 0.600.00190.0077
0.40 / 1.600.00500.0204
3.00 / 15.000.0400.171

So an analysis costs between a fifth of a cent and four cents, depending on the model, and up to 17 cents in the worst case with an expensive one. Measured on the system this engine comes from: USD 0.08 to 0.20 for a weekly run of 15 to 25 calls, about half a cent to a cent a call. No model is named here because none is promised.

An uptime check. One request a minute, made inside the pass that runs anyway: about USD 0.02 a month for its 43,200 result rows and its share of the worker’s time.

Two self-hosted examples

The two projects of Deployment shapes, summed by service. The line-by-line arithmetic is there; the last rows add two small fixed items that table leaves out.

USD a monthSmall: 4 million events, 30,000 sessionsMedium: 40 million events, 300,000 sessions
Lambda3.3115.26
SQS0.604.00
S3: writes, reads, storage3.5214.34
CloudWatch logs0.502.00
CloudFront0.00 (inside the allowance)0.00
The engine≈ 8≈ 36
RDS for PostgreSQL≈ 14 (db.t4g.micro)25 to 50 (2 to 4 GB of memory)
Total, as on the other pages≈ 22≈ 60 to 85
Three alarms, the database’s public address0.30 + 3.65 = 3.953.95
Everything on the bill≈ 26≈ 64 to 89
With the functions in a private network instead+ 32.85 for the NAT gateway, − 3.65The same

Not included: the model, at your provider’s price (a project that makes 200 usual analyses a month at 0.40 / 1.60 pays USD 1.00), and data leaving AWS when you watch replays (0.09 per GB).

One small project, at its usage

What one small project adds to the bill of a deployment that is already running, line by line, from the unit costs above. The project, a month: up to 20,000 events received (5,000 of them errors, traces and samples, the rest free events), 50 replays of at most 30 minutes kept 7 days, one uptime check and 50 analyses. The deployment itself, its idle cost and its database, is not in it.

At the worst shape, every event alone in a batch, every replay at its longest and watched once, every analysis the largest the engine allows:

LineUsageUnit cost, worst shapeUSD a month
Events received20,000 batches of one event0.0122 per 1,000 batches0.24
…their sessions10,000 sessions, two files written each5.00 per million writes0.10
…their roll-upsA run in every 5 minutes of the month: 8,640 × 0.3 GB-s0.0000133334 per GB-s0.04
Replays50 × 180 chunks, 36 MB each, kept 7 days; every one watched once0.0021 to store + 0.0033 to watch0.27
Uptime check43,200 checks0.02
Analyses, model at 0.40 / 1.6050 of the largest0.02041.02
Total≈ 1.69

The same project with the shape real apps have (4.4 events a batch, short replays of which one in five is watched, usual analyses) adds about USD 0.31: analyses 0.25, events 0.03, the uptime check 0.02, replays 0.01.

Figure. What one small project adds to the engine's bill a month, by component. The model's analyses are most of it at either shape.
Read this diagram as text

Two stacked bars on an axis from USD 0 to 2 a month. One small project at the worst shape adds USD 1.69: AI analyses 1.02, events (receive, store, process) 0.38, replays (store and watch) 0.27, uptime check 0.02. The same project with the shape real apps have adds USD 0.31: AI analyses 0.25, events 0.03, uptime check 0.02, replays 0.01.

Two things to read from it:

  1. The model is the bill. Storage, events and replays together are under half of the worst case and under a fifth of the real one. With a model at 3.00 / 15.00, the same 50 analyses cost up to USD 8.55; the engine’s default is 100 a day for each project, so SYPNIA_AI_MAX_ANALYSES_PER_DAY is the first number to set. See Limits.
  2. Long recordings that are all watched are the next line. At two hours, 50 replays cost 50 × (7.58 + 13.25) ÷ 1,000 = 1.04 to store and watch once, plus 0.17 for each month they are kept. Most of it is the data leaving AWS when they are watched.

A self-hosted engine sends alerts by webhook, so there is no e-mail line.

What changed from the system this comes from

ThereHereWhy
An ingest function, an hourly one, a daily one and a weekly one, in TypeScript, with a native query engine as a 68 MB bindingThree functions by role, one Rust binary, no native dependencyOne program to read, arm64, 300 ms cold starts
A managed delivery stream between ingest and the bucketSQS, with a dead-letter queue and a redrive commandFreshness; objects named by project; failures you can see
The app’s shared database, with one role for everythingA database and a role of the engine’s own, on an instance in a stack of its ownThe shared one ran out of memory once. Separate databases and roles keep each application to its own data; the instance is resized, not migrated, when it runs short
Retention as bucket lifecycle rules and a database cron extensionThe engine’s daily jobThe same on any store and any Postgres
Cost estimated once, for one appA unit cost per batch, replay and analysisAny deployment can be priced from its traffic before it runs

Next

  1. The services
  2. Where the Rust is, and where the logic is
  3. From crates to functions to services
  4. One request through the real services
  5. Limits and settings in one place
  6. The template
  7. Postgres: which one, and why
  8. The cost model
  9. Prices used
  10. An idle deployment
  11. Unit costs
  12. Two self-hosted examples
  13. One small project, at its usage
  14. What changed from the system this comes from
  15. Next

    Search pages, sections and terms