Security in Managed PostgreSQL
Who may do what (IAM), what is audited, how data is encrypted at rest, in backups and in transit, and who can reach a database.
IAM actions
Every operation is checked against your IAM policies. A database's resource name is
rn:ews:<region>:<org>:rds:db/<db id>.
| Action | Access | What it allows |
|---|---|---|
rds:DescribeDBInstances | Read | List DB instances |
rds:CreateDBInstance | Write | Create DB instances |
rds:DeleteDBInstance | Write · destructive | Delete DB instances |
rds:StartDBInstance | Write | Start stopped DB instances |
rds:StopDBInstance | Write · destructive | Stop running DB instances |
rds:RebootDBInstance | Write · destructive | Reboot DB instances |
rds:RotateDBStorageKey | Write | Replace the LUKS passphrase of every node’s encrypted data volume with a new key |
rds:FailoverDBInstance | Write · destructive | Promote a replica and demote the current primary |
rds:DescribeDBQueryStats | Read · sensitive | Read the statements a database spends its time on (pg_stat_statements) |
rds:DescribeDBQueryInsights | Read | Read query insights: statement history, findings, running sessions and the slow query log |
rds:CancelDBSession | Write · destructive | Cancel a running statement or end a client session of a database |
rds:ModifyDBQueryInsights | Write | Change query insights settings: the slow query log, auto_explain, and keeping plans with values |
rds:CreateDBReadReplica | Write | Add a read replica to a cluster |
rds:DeleteDBReadReplica | Write · destructive | Remove a read replica from a cluster |
rds:DescribeDBBranches | Read | List a database’s branches, their branch pool and its operations |
rds:CreateDBBranch | Write | Cut a copy-on-write branch of a database (masked; builds the branch pool on first use) |
rds:DeleteDBBranch | Write · destructive | Delete a branch and everything written to it |
rds:ModifyDBBranch | Write | Change when a branch expires |
rds:GetDBBranchCredentials | Read · sensitive | Read the passwords of a branch’s login roles |
rds:ModifyDBBranchSettings | Write | Set a database’s masking rules and pull-request branches, and refresh its branch pool |
rds:CreateDBReplicationSlot | Write | Declare a logical replication slot (kept across failover on a cluster) |
rds:DeleteDBReplicationSlot | Write · destructive | Drop a logical replication slot; its consumer has to resynchronise |
rds:ModifyDBInstance | Write · destructive | Change storage, server type, autoscaling, the maintenance window, or upgrade the minor version |
rds:DescribeDBParameters | Read | Read the PostgreSQL parameters a database runs with, and their defaults |
rds:DescribeDBLogFiles | Read · sensitive | Read a database's PostgreSQL server log |
rds:ModifyDBParameters | Write | Set or reset PostgreSQL parameters (work_mem, timeouts, logging…) |
rds:QueryDatabase | Read · sensitive | Browse schemas, tables and rows, and run read-only queries |
rds:DescribeDBSnapshots | Read | List DB snapshots |
rds:DescribeDBExtensions | Read | List the Postgres extensions a database supports and which are enabled |
rds:EnableDBExtension | Write | Create a supported extension in a database, adding its library to the preload list if needed |
rds:DisableDBExtension | Write · destructive | Drop an extension from a database, with CASCADE only when confirmed |
rds:DescribeDBLogins | Read | List the per-person database logins and their open sessions |
rds:CreateDBLogin | Write | Create a named Postgres login (read-only or read-write) whose password is filed in Secrets |
rds:DeleteDBLogin | Write · destructive | Revoke a database login: end its sessions and drop its role |
rds:ModifyDBLogin | Write | Set or clear a database login's expiry (VALID UNTIL) |
rds:RotateDBLoginPassword | Write · destructive | Give a database login a new password, filed as a new version of its secret; the old one stops working |
rds:ListBackups | Read | List backups and the point-in-time recovery window |
rds:CreateBackup | Write | Request an on-demand backup |
rds:DeleteBackup | Write · destructive | Delete a backup taken by hand that is kept until deleted (older than the retention window it is removed from the repository) |
rds:RestoreDBInstance | Write · destructive | Restore a database to a point in time from its backups |
Generated from the service’s IAM descriptor. Sensitive reads hand over secret material or source code and are recorded in the audit log like writes; destructive writes delete, overwrite or revoke.
- Branch actions are checked on the parent database's resource name
(
rn:ews:de1:<org>:rds:db/<db id>), so a policy grants branching database by database. The console's capability "Branches" on a database bundles them. - Sensitive reads are recorded in the audit log even when they are allowed:
rds:QueryDatabase(the data browser, which reads every table with the master credential, and which no read-only preset includes),rds:DescribeDBLogFiles(the server log carries statement text with its values),rds:DescribeDBQueryStats(the statements a database spends its time on, which name every table and column), andrds:GetDBBranchCredentials(a branch's passwords, a binding to a branch, the CI variable).rds:DescribeDBQueryInsightsis an ordinary read, but is audited too while the database keeps plans with values. - Reading the master password or a login's password is
secrets:GetSecretValueon its secret, and is recorded in the audit log. - Choosing your own encryption key at creation needs
kms:Encrypton that key. - Cancelling a restore needs
rds:RestoreDBInstanceon the source database.
Audit
Every write is recorded in the audit log with its outcome. So are: reading a secret value, browsing data, reading query statistics, reading the server log, reading branch credentials, cancelling a statement or ending a session (also in Activity), cancelling a restore, and every read of query insights (the Queries tab) while Show values and plans is on.
Encryption at rest
Every node's data volume is encrypted with LUKS2 (AES-256-XTS). Each volume has its own random key, held by the control plane wrapped under the platform key (see Key custody). A machine gets the key only at boot (see What runs on your machines). A volume detached from its machine, or a copy of its blocks, is unreadable. Deleting the database deletes the keys.
This covers single nodes, every cluster member and reader, a member rebuilt after its machine was lost (it opens its kept volume with that volume's key, or gets a new volume and key and copies from the leader), and a database restored from a backup.
Your own key. Choose one of your KMS keys under Encryption key when you create the
database, or pass "kmsKeyId" to the create request. Every node volume's key is then wrapped by
it, including volumes added later (readers, rebuilt members). Disabling the KMS key stops nodes
from opening their disks at their next boot; deleting it (after its waiting period) makes the data
unreadable for good. A restore takes the source's key unless you name another ("kmsKeyId", or
null for the platform key). The key of an existing database's disks cannot be changed; restore
into a new database with the key you want.
Backups are encrypted separately, with AES-256-CBC on the database machine before upload, one passphrase per database (see Back up a database).
The API reports both as encryption: { storage: "luks2" | "none", backups: "aes-256-cbc" | "none" },
and the Overview shows Disk encryption and Backup encryption. storage is none for a
database created before disk encryption existed: its volumes stay unencrypted, a rebuilt member's
included, and nothing changes them in place. To encrypt one, restore it
into a new database, which is encrypted, and point your apps at the new one.
Rotate the disk keys
Replace ewdb-0123456789ab with your database's id. It needs rds:RotateDBStorageKey.
Not available in Console. Rotating the disk keys is in the CLI and API only.
dcloud rds instances rotate-storage-key ewdb-0123456789abPOST /rds/api/instances/ewdb-0123456789ab/rotate-storage-keyNot available in Terraform. A rotation is an action, not configuration.
Every node volume gets a new key: each node adds the new key to its volume, removes the old one
and reports within five minutes; nothing restarts. The answer is 202 with each volume's key
version, and the database's events say when each volume is done. The data is not re-encrypted: the
rotation replaces the passphrase that unlocks the volume, not the volume key itself.
It is refused with 409 for a database created before disk encryption ("This database was created
before disk encryption; its disks have no key to rotate. Restore it into a new database.") and
while a rotation is still in progress ("A key rotation is already in progress").
Encryption in transit
Every port serves TLS on a database provisioned with a certificate, and a new database refuses clients that do not use it unless Require TLS was cleared at creation (see Require TLS). Certificates are issued per database by the installation's CA and renewed automatically; see Connect to a database.
Network exposure
A database is private unless you create it with publiclyAccessible: only machines in its network
and the platform's control plane reach it. A public database answers on its ports from anywhere;
the password is required either way, and TLS while Require TLS is on. A copy made by a restore in the console is
private unless someone selects Reachable from the internet; through the API it takes the
source's setting unless the request says publiclyAccessible. See Instances, clusters and endpoints.
Logins and the platform's role
Give each person a login of their own instead of sharing the master password (see
Create a login). The platform works in your database as its own role,
ews_platform, which your server log names and query statistics leave out (see
What runs on your machines).