Static IP guide
Connecting to Amazon Redshift with a static IP from a Node app on Vercel
Product dashboards and API routes on Vercel sometimes need to query Redshift directly, and the cluster's security group will not accept connections from anonymous serverless IPs. Because Redshift is Postgres-compatible on port 5439, the pg driver with a socksjs stream through Fixie covers it — no VPC peering, no bastion host.
Recommended setup
Use Fixie Vercel integration for Amazon Redshift connections that require a stable source IP. Store the proxy value in FIXIE_SOCKS_HOST, then configure Node.js to route outbound traffic through Fixie before connecting to Amazon Redshift.
Set up Fixie on Vercel
Add the Fixie Vercel integration, create a proxy in the Fixie dashboard, and connect it to the Vercel project and environment. The integration can create FIXIE_SOCKS_HOST in Vercel Environment Variables for the connected project.
Pull Vercel environment variables locally
vercel env pull
grep FIXIE_SOCKS_HOST .env.localImplementation
The example below shows the core application-side change. Keep credentials in environment variables and avoid committing proxy, database, or API secrets.
Connect to Amazon Redshift through FIXIE_SOCKS_HOST
const pg = require('pg');
const SocksConnection = require('socksjs');
const fixieValues = process.env.FIXIE_SOCKS_HOST.split(new RegExp('[/(:\\/@)/]+'));
const databaseServer = {
host: 'redshift-cluster.example.com',
port: 5439,
};
const fixieConnection = new SocksConnection(databaseServer, {
user: fixieValues[0],
pass: fixieValues[1],
host: fixieValues[2],
port: fixieValues[3],
});
const client = new pg.Client({
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
stream: fixieConnection,
ssl: true,
});
client.connect()
.then(() => client.query('select 1 as ok'))
.then((result) => console.log(result.rows[0]));Good to know
- Analytics queries can exceed default function timeouts; raise maxDuration for these routes or push heavy aggregation into materialized views on the cluster.
- The cluster must be publicly accessible with both Fixie IPs allowed inbound on 5439.
Allowlist and test the static IPs
- Open the Fixie dashboard and copy the outbound IP addresses for this proxy.
- Add both IPs to the Redshift security group.
- Deploy the updated Node.js app on Vercel.
- Run a small connection test before sending production traffic.
Related guides
- Making API requests with a static IP from a Node app on Vercel
- Connecting to Amazon Redshift with a static IP from a Node app on Heroku
- Connecting to Postgres with a static IP from a Node app on Vercel
- Connecting to Amazon Redshift with a static IP from a Node app on AWS Lambda
- Connecting to MySQL with a static IP from a Node app on Vercel
- Connecting to MongoDB with a static IP from a Node app on Vercel