Skip to main content
This guide connects the gateway to an RDS or Aurora Postgres database that stays private in its VPC. You need a Midplane project (get started).
1

Run the gateway inside the VPC

The AWS template runs it on EC2 in a subnet you pick, and can admit it to the database’s security group. On ECS or EKS, run it in a subnet that reaches the database (deploy the gateway, Kubernetes), and in the database’s security group allow the gateway’s on port 5432.
2

Create a role for the gateway

Connect with psql as the master user, replace the placeholders, and run:
This role can only read. To let agents write, see letting agents write. Use a password, not IAM authentication: IAM tokens expire after 15 minutes, and the gateway reads its connection string once, at start.
3

Download the RDS certificate bundle

The AWS template downloads it for you. Elsewhere, save the global RDS bundle as rds-global-bundle.pem where the gateway runs: in Docker, in /etc/midplane/tls on the server, mounted at the same path. The commands for My own certificate mount that folder already; for the others, add -v /etc/midplane/tls:/etc/midplane/tls:ro after docker run in each.
4

Give setup the connection string

Use the endpoint from the database’s Connectivity & security tab. For agents that only read, prefer the Aurora reader endpoint or a read replica: it refuses writes whatever the policy says.
sslrootcert is the bundle’s path where the gateway runs: /etc/midplane/tls/rds-global-bundle.pem in Docker and with the AWS template, or the file’s full path on your computer. Put the line after its MIDPLANE_DSN_…= in the env file, or paste it when midplane setup asks for the connection string (deploy the gateway).
5

Check that it connects

Setup says ok with the database and its number of tables. Once the gateway runs, Test connection on the Gateways page shows your database’s id with ok, such as shop ok, 3 ms, and the policy editor lists your tables.

If it doesn’t work

  • ETIMEDOUT or TIMEOUT: the security group doesn’t admit the gateway.
  • SELF_SIGNED_CERT_IN_CHAIN: sslrootcert is missing or names the wrong file.
  • 28000: the instance requires TLS (rds.force_ssl) and the connection string has no sslmode.