Connect PostgreSQL to Redshift
To connect PostgreSQL to Redshift, create a read-only source role and link both network paths. You then map schemas or run a data transfer tool between the two engines. Most data teams start by reusing an admin account to test the link fast. That shortcut stays in place and leaves broad read and write permissions open. How to connect PostgreSQL to Redshift with least privilege A safe setup starts on the source database before you move any table rows. You should create a dedicated group role f
PostgreSQL Access Control + Redshift Security: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
To connect PostgreSQL to Redshift, create a read-only source role and link both network paths. You then map schemas or run a data transfer tool between the two engines. Most data teams start by reusing an admin account to test the link fast. That shortcut stays in place and leaves broad read and write permissions open.
How to connect PostgreSQL to Redshift with least privilege
A safe setup starts on the source database before you move any table rows. You should create a dedicated group role for the data link on the source. In PostgreSQL, group roles help teams manage rights when many users or services exist. You grant specific service accounts membership in that group role to keep rules clean.
Next, you must lock down default database rights on the source system. A special role named PUBLIC grants rights to every role on the system. By default, PUBLIC gets the right to log in and make temp tables. It also gets the right to run functions and procedures on the database. The object owner can revoke these default rights from PUBLIC to tighten control. In version 15 and later, normal users cannot create objects in the public schema. On older databases, an admin must revoke that create right from PUBLIC by hand.
After you clear the defaults, you grant read rights to your sync role. The SELECT right allows reading from a whole table, view, or materialized view. You can also grant SELECT on specific columns of a table instead of all columns by default. This same SELECT right also allows the role to export data out. When you scope SELECT to safe columns, you stop raw emails or card numbers from moving. Once the source role is ready, the warehouse logs in over a private network path.
Why native roles fall short during live data syncs
Scoping source and warehouse roles solves the first half of the access problem. It controls which service or analyst can log in to the database engines. It also limits which tables and columns that role can read at rest. Still, static database grants do not watch what happens after a session starts.
Once a sync user or analyst logs in, the database trusts every valid query. Native roles cannot pause a dangerous query for human review before it runs. They also cannot rewrite sensitive fields like phone numbers or national IDs in query results. If a shared warehouse role leaks, anyone with that key can export every allowed row. Teams also struggle to tie shared role queries back to a single person.
PostgreSQL Access Control + Redshift Security: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Managing warehouse and source queries in one flow
Modern data teams run both transactional databases and analytical warehouses side by side. Engineers often query both systems during an incident or while building a new pipeline. Managing separate role trees and static passwords across both engines takes a lot of time. People end up sharing credentials just to get their daily work done on time.
A better approach checks every query in flight instead of trusting the login alone. When you inspect statements at runtime, you can apply data masking to results right away. Masking rewrites matched fields like emails or card numbers in results before they return. You can also require a quick peer approval when someone runs a sensitive command. This keeps both your source database and your warehouse safe without complex role sprawl.
Add runtime guardrails and masking beside your databases and APIs
Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits inline in the protocol beside the service as an open-source proxy, a sidecar for your database or API. On every production query an agent or human runs, hoop.dev decides whether to pass, mask, block, or escalate it for review.
Before a query runs, hoop.dev guardrails check the statement against your rules, an AI Analyzer you configure can score intent or hold risky calls for human approval, and hoop.dev data masking rewrites sensitive fields in responses in memory. Explore the MIT-licensed project on GitHub.
Frequently asked questions
Should I use a superuser account to link my source database and warehouse?
No, you should never use a superuser account for a data sync link. Create a dedicated role and grant SELECT only on the specific columns you need.
How do I stop the sync role from creating new objects in the source?
On PostgreSQL 15 and newer, users cannot create objects in the public schema by default. On older versions, an admin must revoke the create right on the public schema from PUBLIC.
Can PostgreSQL column grants hide sensitive data from warehouse analysts?
Column grants can block a sync role from reading specific columns on the source table. To rewrite emails or phone numbers in live query results, you need dynamic data masking.
Related guides
In this post