This guide explains how to use pgstream with AWS RDS/Aurora databases, covering snapshots and replication. 👉 Throughout this guide:Documentation Index
Fetch the complete documentation index at: https://xata.io/docs/llms.txt
Use this file to discover all available pages before exploring further.
pgstreamsourcerefers to the user provided in the pgstream source URL.pgstreamtargetrefers to the user provided in the pgstream target URL.
Snapshots
From AWS RDS/Aurora Database (Snapshots)
Quick Checklist
- Create a source user (
pgstreamsource) with access to required schemas/tables. - For roles without passwords → no special config needed.
- Snapshot of roles with passwords is not supported.
- Update YAML config with correct snapshot settings.
Steps
-
User privileges
Ensure the
pgstreamsourceuser (from the pgstream source URL) can access the database schema and tables you need. -
Roles handling
- No roles → no changes required.
- Roles without passwords → no changes required.
-
Roles with passwords → not supported by AWS.
If you try to snapshot roles with passwords, you’ll see:
-
Config when not snapshotting roles
If roles are disabled or not manually managed, add the following to avoid failures:
Example full configuration:
rdsadmin, rds_reserved, rds_extension, rds_ad, rds_password, rds_iam, rds_replication, rds_superuser and postgres) will not be snapshotted.
To AWS RDS/Aurora Database (Snapshots)
Quick Checklist
- Create a target user (
pgstreamtarget) for the pgstream target URL. - Grant privileges for schema/database ownership.
- Grant optional privileges depending on features (create DB, create roles).
- Use
disable_triggers: false(required for all non-rds_superuserusers).
Steps
Thepgstreamtarget user (from the pgstream target URL) must have the following privileges:
-
Schema ownership
-
Database creation (if
create_target_dbis enabled) -
Role creation (if
roles_snapshot_modeisenabled/no_passwords)⚠️pgstreamtargetmust already hold any privileges it assigns (e.g.,REPLICATION). -
Disable triggers (required for AWS RDS/Aurora)
⚠️ AWS RDS/Aurora only allows setting
session_replication_roleforrds_superuserroles. You must disable trigger management in pgstream if using a non superuser role:❌ If usingdisable_triggers: trueand a role without enough privileges, pgstream will fail with:
Replication
From AWS RDS/Aurora Database (Replication)
Quick Checklist
- Ensure logical replication is enabled (
rds.logical_replication=1in parameter group). - Use the
postgresuser or a user withrds_superuserfor initialization. - Grant
rds_replicationrole for replication privileges. - Optionally use a different
pgstreamsourceuser for streaming.
Steps
-
Enable logical replication
Logical replication requires
wal_levelto be set tological. Check current setting:If not set tological, update it: AWS RDS and Aurora require modifying the database parameter group:- Go to the AWS RDS Console
- Navigate to Parameter groups in the left sidebar
- Create a new parameter group or select your existing custom parameter group
- Note: You cannot modify the default parameter groups
- Search for and modify the
rds.logical_replicationparameter:- Set
rds.logical_replicationto1(enabled)
- Set
- Apply the parameter group to your RDS/Aurora instance:
- Go to your database instance
- Click Modify
- Under Database options, select your custom parameter group
- Apply the changes
- Reboot your database instance for the changes to take effect
⚠️ Important notes:- Setting
rds.logical_replication=1automatically setswal_level=logical - This change requires a database reboot
- Logical replication may increase storage usage due to retained WAL files
- Ensure you have adequate monitoring for replication slot lag
-
Replication phases
- Initialization → requires elevated privileges to create schemas, event triggers, and replication slots.
- Streaming → can use a dedicated
pgstreamsourceuser.
Initialization
Initialization does the following:- Creates
pgstreamschema - Creates replication slot (if missing)
- Creates event triggers/functions for schema changes
rds_superuser privileges (typically the postgres user) for initialization, as creating event triggers requires elevated privileges:
Streaming
After initialization, you can:- Keep using
postgres, or - Transfer ownership to a dedicated
pgstreamsourcerole.
To AWS RDS/Aurora Database (Replication)
Quick Checklist
- Ensure
pgstreamtargethas schema/database ownership. - If combined with snapshot → follow Snapshot target requirements.
Steps
Privileges required:Troubleshooting
permission denied for table pg_authid
permission denied for table pg_authid
Cause: Roles with passwords require pg_authid access.
Fix: AWS RDS doesn’t allow access to
Fix: AWS RDS doesn’t allow access to
pg_authid. Disable role passwords (roles_snapshot_mode: disabled or no_passwords).permission denied to set parameter "session_replication_role"
permission denied to set parameter "session_replication_role"
Cause: AWS RDS only allows setting this parameter when using an
Fix: Set
rds_superuser role.Fix: Set
disable_triggers: false in target config or use a role with enough privileges.permission denied for schema public when transferring ownership
permission denied for schema public when transferring ownership
Cause: Target role lacks CREATE privilege on schema.
Fix: Grant CREATE on schema to the role:
Fix: Grant CREATE on schema to the role:
GRANT CREATE ON SCHEMA public TO role_name;Role creation fails
Role creation fails
Cause:
Fix: Grant required privileges to
pgstreamtarget lacks privileges it tries to assign.Fix: Grant required privileges to
pgstreamtarget first, or use a user with more privileges.must be superuser to create event triggers
must be superuser to create event triggers
Cause: Initialization user lacks sufficient privileges.
Fix: Use the
Fix: Use the
postgres user or grant rds_superuser: GRANT rds_superuser TO username;cannot set parameter "rds.logical_replication"
cannot set parameter "rds.logical_replication"
Cause: Parameter can only be set in parameter group.
Fix: Modify the parameter group via AWS Console, not via SQL.
Fix: Modify the parameter group via AWS Console, not via SQL.