How pilot reaches its database
From a page request in the browser to PostgreSQL on RDS in Cape Town, with the real names of every Worker, Hyperdrive config, tunnel and network piece. As deployed on 30 October 2026.
10 November 2026: the pilot environment becomes prod, the one deployed environment (ADR-0058). This page is kept as written.
Cloudflare
AWS, Cape Town
Exists, not in use
The connection between the Tunnel and cloudflared is opened from inside AWS; requests then travel back in over it.
One page request, step by step
- The browser asks for
test.platform.catalystholdings.global. Cloudflare runs thewebWorker. webcallsgatewaythrough a service binding. Workers call each other inside Cloudflare, not over the internet.gatewaychecks the session (through its Hyperdrive configidentity), then calls the service that holds the data, for exampleanalysis.- The service sends its SQL to its own Hyperdrive config. Hyperdrive keeps a pool of open connections, so most queries skip the set-up.
- When Hyperdrive needs a new connection, it goes to
db-pilot.catalystholdings.globaland shows the…-pilot-hyperdriveservice token. Access checks it. - Access passes the connection into the Tunnel. The Tunnel carries it over the link
cloudflaredalready opened from AWS. cloudflared, inside the VPC, connects to RDS on port 5432. Postgres requires TLS, and Hyperdrive checks RDS's certificate against Amazon's RDS root CA for af-south-1 (verify-ca).- Postgres checks the login (
platform_svc_analysisin this example) and its row-level security rules, then answers back along the same path.
Why the internet cannot reach the database
- RDS has no public address (publicly accessible: false). Its name resolves to a private
10.40.x.xaddress. - The data subnets have no route out: only
10.40.0.0/16 local. No internet gateway, no NAT. - RDS's security group admits port 5432 from one source: the cloudflared security group. No IP ranges.
- Nothing in AWS accepts a connection from outside.
cloudflareddials out to Cloudflare through the NAT gateway, and its own security group only allows Cloudflare's tunnel port, RDS and the private endpoints. - The one public name,
db-pilot.catalystholdings.global, ends at Cloudflare Access, which turns away anything without one of the two service tokens. - Past all that, every connection still needs a database user and password, over SSL.
Which Worker uses which connection
| Worker | Binding | Hyperdrive config | Database login |
|---|---|---|---|
| catalyst-platform-web-pilot | none | none | none: pages only, calls the gateway |
| catalyst-platform-gateway-pilot | HYPERDRIVE | catalyst-platform-pilot-identity | platform_svc_identity |
| catalyst-platform-identity-pilot | HYPERDRIVE | catalyst-platform-pilot-identity | platform_svc_identity |
| catalyst-platform-xero-connector-pilot | HYPERDRIVE | catalyst-platform-pilot-xero-connector | platform_svc_xero_connector |
| catalyst-platform-analysis-pilot | HYPERDRIVE | catalyst-platform-pilot-analysis | platform_svc_analysis |
| RULES_HYPERDRIVE | catalyst-platform-pilot-analysis-rules | platform_svc_analysis_rules | |
| catalyst-platform-report-pilot | HYPERDRIVE | catalyst-platform-pilot-report | platform_svc_report |
| catalyst-platform-datahouse-pilot | HYPERDRIVE | catalyst-platform-pilot-datahouse | platform_svc_datahouse |
| HYPERDRIVE_REID | catalyst-platform-pilot-datahouse-reid | platform_svc_datahouse_reid | |
| catalyst-platform-vas-pilot | HYPERDRIVE | catalyst-platform-pilot-vas | platform_svc_vas |
| catalyst-platform-audit-pilot | HYPERDRIVE | catalyst-platform-pilot-audit | platform_svc_audit |
How migrations reach it
infra/deploy/rds-from-poc.shreads the…-pilot-ci-migrationstoken from Terraform (needs your AWS login,aicfo-pilot).- It runs
cloudflared access tcptodb-pilot.catalystholdings.global, which opens127.0.0.1:15432on your Mac. psqlconnects to that port asplatform_owner(migrations, staff accounts) or as the RDS master user (creating roles; its password is in AWS Secrets Manager).- The connection travels the same Access, Tunnel and cloudflared path as Hyperdrive's, and closes when the command ends.
Where each piece is defined
- AWS, the Tunnel, Access and the tokens: Terraform
infra/terraform/envs/pilot-aws-db, state in an encrypted S3 bucket in the same AWS account. - Hyperdrive configs, logins' passwords, R2 buckets: Terraform
infra/terraform/envs/pocwithpilot.tfvars, state in R2. - Workers and their bindings: each repository's
wrangler.jsonc, deployed withinfra/deploy/deploy-poc.sh. - Database roles and logins:
rds-from-poc.sh bootstrap; schema from0011_platform_baseline.sql.
Monthly running cost of the AWS side is about $141 to $143: the NAT gateway and the five private endpoints are about two thirds of it, the database about a quarter.