Static IP guide
Connecting to Postgres with a static IP from a Node app on AWS Lambda
A Lambda function querying an allowlisted Postgres database usually gets forced into a VPC with NAT just to stabilize its address. Fixie Socks avoids that entirely: the function stays VPC-free, opens a socksjs stream inside the invocation, and RDS admits it because the security group lists Fixie's two IPs.
Recommended setup
Use Fixie Socks proxy for Postgres connections to a database that only accepts traffic from approved IP addresses. Store the proxy value in FIXIE_SOCKS_HOST, then configure Node.js to route outbound traffic through Fixie before connecting to Postgres.
Set up Fixie on AWS Lambda
Create a Fixie Socks proxy in the Fixie dashboard. Copy the proxy value into AWS Lambda environment variables as FIXIE_SOCKS_HOST, and copy the outbound IPs into the destination allowlist.
Set an AWS Lambda environment variable
Implementation
The example below shows the core application-side change. Keep credentials in environment variables and avoid committing proxy, database, or API secrets.
Connect to Postgres through FIXIE_SOCKS_HOST
Good to know
- Connect and disconnect within the handler; sockets left open when the execution environment freezes will be dead on thaw.
- Add both Fixie IPs to the security group on port
5432; a database in a private subnet must also be made publicly accessible for this path. - For high-frequency functions, batch events (SQS batching works well) so connection churn does not overwhelm the database.
Allowlist and test the static IPs
- Open the Fixie dashboard and copy the outbound IP addresses for this proxy.
- Add both IPs to the Postgres firewall or security group.
- Deploy the updated Node.js app on AWS Lambda.
- Run a small connection test before sending production traffic.
Related guides
- Making API requests with a static IP from a Node app on AWS Lambda
- Connecting to Postgres with a static IP from a Node app on Heroku
- Connecting to Amazon Redshift with a static IP from a Node app on AWS Lambda
- Connecting to Postgres with a static IP from a Node app on Vercel
- Connecting to Postgres with a static IP from a Node app on Render
- Connecting to Postgres with a static IP from a Node app on Fly.io
Related docs
- Node.js implementation examples
- AWS Lambda setup documentation
- Postgres connection guide
- Fixie-Wrench for TCP forwarding
Is this guide useful?