Use a PostgreSQL-compatible connection string with an SQL client extension (e.g., SQLTools) to query Amazon Redshift directly from VS Code.
Ensure you have: 1) Amazon Redshift endpoint, port (default 5439), database name, user, and password; 2) VS Code installed; 3) an SQL client extension such as SQLTools or Database Client; 4) PostgreSQL driver selected inside the extension because Redshift speaks the PostgreSQL wire protocol.
Open VS Code → Extensions panel → search “SQLTools” → click Install.After install, open Command Palette (⌘/Ctrl + Shift + P) → “SQLTools: Install Driver” → choose “PostgreSQL/Redshift”.
Inside VS Code, press ⌘/Ctrl + Shift + P → “SQLTools: Add New Connection”. Pick PostgreSQL/Redshift. Fill the form with host, port, database, user, and password.Optionally add ssl=true
for encrypted traffic or timeout=30
seconds.
{ "name": "Prod-Redshift", "driver": "PostgreSQL", "host": "example-cluster.abc123.us-east-1.redshift.amazonaws.com", "port": 5439, "database": "analytics", "username": "galaxy_read", "password": "••••", "ssl": true }
SQLTools accepts URI or key-value. URI format: postgresql://user:pass@host:port/database?ssl=true&connect_timeout=10
. Replace each placeholder with your Redshift values.
In SQLTools sidebar, right-click the new profile → Test Connection. A green check confirms success.If it fails, re-check security-group rules, username/password, and SSL setting.
Create a .sql
file, select your connection in the bottom bar, highlight SQL, press ⌘/Ctrl + Enter. Results show in an embedded panel with tabs for Results, Messages, and Query Plan.
SQLTools supports snippets and .sql files under version control.Use Galaxy Collections for sharing endorsed queries with teammates to avoid copy-pasting in Slack.
Right-click the connection → Disconnect. Connections auto-close after inactivity if idleTimeout
is set in the profile.
Use IAM-based passwords rotated via AWS Secrets Manager. Limit Redshift user to read-only if you only run analytics. Store connection profiles in settings.json
but exclude passwords from Git.
.
No. The PostgreSQL driver works because Redshift implements the same protocol, but choosing the Redshift-optimized driver disables unsupported features like SAVEPOINT
.
Yes. Generate a temporary auth token with AWS CLI aws redshift get-cluster-credentials
and place it in the password field; set ssl=true
.
After connecting, click the refresh icon in SQLTools Explorer. The extension pulls schema metadata so IntelliSense works across Customers, Orders, and more.