Skip to content

Architecture on AWS

This page shows the reference architecture for running Spongram in an AWS account, built from the Terraform profile in deploy/aws/ and the Helm chart in deploy/helm/spongram/. For the procedure, see deploying on AWS.

Reference architecture

These artefacts have been validated offline with terraform validate, helm lint and helm template. The vendor has not performed an AWS deployment with them. The profile runs one API replica, and Neo4j and Graphiti are single-instance StatefulSets: it is not a high-availability qualification. Treat throughput, recovery objectives and failover behaviour as things to measure in your own acceptance tests.

Open the diagram in its own tab.

What runs where

Need Component Provided by
API, console, background workers spongram Deployment, one replica, port 8091, with the Cloud control plane enabled Helm chart
Schema migrations A Job with its own service account, IAM role and database account Helm chart, enabled per upgrade
Extraction and search spongram-graphiti StatefulSet, port 8000, with a receipt spool on a persistent volume Helm chart
Knowledge graph spongram-neo4j StatefulSet, Neo4j 5.26 Community, on an encrypted persistent volume Helm chart
Relational data RDS for PostgreSQL 17, Multi-AZ, encrypted, TLS enforced Terraform
Object storage Two private, versioned, KMS-encrypted S3 buckets: objects and backups Terraform
Secrets Secrets Manager entries, created empty Terraform; values supplied by you
Encryption keys One KMS key with rotation, used by RDS, S3 and the secrets Terraform
Logs A CloudWatch log group with 90 days of retention Terraform; the collector on the cluster is yours to connect
Cluster, network An EKS cluster, a VPC and private subnets Yours. The profile references them and creates none of them.
Ingress controller An ingress controller and its TLS certificate Yours. The chart only creates the Ingress object.

Neo4j stays a StatefulSet in the cluster. The profile does not substitute a managed graph service for it.

Identities

The Terraform profile creates separate IAM roles, each assumable only by one Kubernetes service account through the cluster's OIDC provider:

Role Service account Can do
Application spongram Read the runtime database secret, connect to RDS as the runtime user (IAM database authentication), read and write objects under the orgs/ prefix of the objects bucket, use the KMS key.
Migration spongram-migration Read the migration database secret, decrypt with the KMS key.
Backup spongram-backup Read and write the backups bucket, use the KMS key.

The application role cannot read the migration secret or the RDS master secret. The runtime database account does not own the tables: the migration account owns the schema and grants the runtime account what it needs. This is why the API runs with SPONGRAM_RUN_MIGRATIONS=false and migrations run as a separate job. See upgrades and migrations.

Network

  • The Ingress routes the path prefixes /console, /admin, /mcp, /v1 and /documentation to the spongram service. Nothing else is exposed: Graphiti, Neo4j, PostgreSQL and the internal inference path stay private.
  • A NetworkPolicy allows inbound traffic to the Graphiti and Neo4j pods on ports 8000 and 7687 only from pods of the Spongram release.
  • The RDS security group accepts PostgreSQL connections only from the workload security group you pass to Terraform.
  • MCP uses streamable HTTP with server-sent events. Check the timeouts of your ingress controller and make sure it does not buffer SSE responses.
  • Egress control and the separation from other workloads of the cluster are applied at cluster and VPC level, outside this profile.

Differences from the Swarm layout

Topic Docker Swarm AWS reference
PostgreSQL A container with a bind mount RDS, Multi-AZ, managed backups
Migrations Applied by spongram at start-up A separate job and database account
Accounts Admin token Cloud control plane: organisations, users, grants
Secrets Stack variables Secrets Manager references and workload identity; no static AWS key
TLS Your reverse proxy on the webfacing network Your ingress controller
Neo4j ports Published on the node for administration Not exposed outside the cluster