---
title: "Connect Serverless Apps to RDS With an IP Allowlist"
description: "Reach Amazon RDS or Aurora from Vercel, Netlify, Cloudflare, or Railway: public access tradeoffs, RDS Proxy limits, /32 security group rules, and TLS."
canonical: https://fixedmark.com/blog/serverless-to-rds-with-an-ip-allowlist
updated: 2026-11-10
source: Fixedmark (https://fixedmark.com), BitMask LLP
---

Databases · 11 min read

# Connect Serverless Apps to RDS With an IP Allowlist

A function on Vercel, Netlify, Cloudflare, or Railway runs outside your VPC, so the RDS or Aurora instance needs public access and a security group rule for the caller's source IP. RDS Proxy cannot be reached from outside its VPC. Give the app a fixed egress IP, allow it as a /32 on the database port, and connect with \`sslmode=verify-full\`. On Aurora, the Data API avoids the network path entirely.

## Why the connection fails from serverless

An RDS instance lives inside a VPC and always has a private IP address. A client outside that VPC can reach it only when two things are true. The instance has a public IP, which the Public access setting controls. The instance's security group has an inbound rule that matches the client's source address and the database port. AWS's [troubleshooting guide](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Troubleshooting.html) puts it plainly. By default, DB instances do not allow access.

Serverless platforms break the second condition. Functions on Vercel, Netlify, Cloudflare, and most PaaS hosts send outbound traffic from shared pools that change between deploys, regions, and cold starts. Vercel's [Static IPs docs](https://vercel.com/docs/networking/static-ips) say that without the add-on, deployments use dynamic IP addresses and Vercel publishes no fixed range to allowlist. The post on [why serverless egress IPs change](https://fixedmark.com/blog/why-serverless-egress-ips-change) covers each platform's behaviour.

Security groups only have allow rules. A packet that matches none is dropped, so the driver waits and reports a connect timeout, not a refusal. A missing rule looks like a network outage.

The quick fix people find is Public access set to Yes plus an inbound rule for port 5432 from `0.0.0.0/0`. It works, and it makes the database password the only control between your data and every scanner on the internet. Allowlisting a whole cloud's published ranges is the same problem in a smaller size, as the post on [cloud IP ranges](https://fixedmark.com/blog/cloud-ip-ranges-are-not-an-allowlist) explains.

## What public access actually changes

Public access does not open the database by itself. AWS's [VPC guide for RDS](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.WorkingWithRDSInstanceinaVPC.html) says that when an instance is publicly accessible, its DNS endpoint resolves to the private IP from inside the VPC and to the public IP from outside it. Access is still controlled by the security group. If no inbound rule permits a source, that source gets nothing.

- Every subnet in the instance's DB subnet group must be public, with a route to an internet gateway. A subnet that later turns private can affect the instance's availability.
- The VPC needs the DNS hostnames and DNS resolution attributes turned on.
- RDS manages the public address. It shows up under Elastic IPs with a `service_managed` attribute of `rds`, and you cannot release it.
- The address is billed like any other public IPv4 address, at $0.005 per hour on the [VPC pricing page](https://aws.amazon.com/vpc/pricing/). That is about $3.65 for a 730-hour month. The post on [the AWS public IPv4 charge](https://fixedmark.com/blog/aws-public-ipv4-charge-explained) covers where it appears on the bill.

_The same database under three network setups_

| Setup                                   | Who can open a TCP connection                   | Fits serverless                           |
| --------------------------------------- | ----------------------------------------------- | ----------------------------------------- |
| Private only                            | Resources in the VPC, peered networks, or a VPN | Only Lambda or containers inside that VPC |
| Public access, port open to `0.0.0.0/0` | Any host on the internet                        | Yes, but the password is the only control |
| Public access, two /32 rules            | Only the two listed source addresses            | Yes, once the app has fixed egress IPs    |

Check where an instance stands before you change anything. The query below prints the public access flag, the endpoint, and the security groups attached to it.

**Terminal**

```bash
DB=app-db

aws rds describe-db-instances --db-instance-identifier "$DB" \
  --query 'DBInstances[0].{public:PubliclyAccessible,host:Endpoint.Address,port:Endpoint.Port,sgs:VpcSecurityGroups[].VpcSecurityGroupId}'

# Turn on public access only after the security group is narrow
aws rds modify-db-instance --db-instance-identifier "$DB" \
  --publicly-accessible --apply-immediately
```

## Why RDS Proxy does not help from outside AWS

RDS Proxy is the usual advice for serverless and databases, because it pools connections and absorbs bursts of new ones. It does not solve reachability. The [RDS Proxy limitations](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy.html) say the proxy must be in the same VPC as the database and cannot be publicly accessible, although the database can be. A function on Vercel or Netlify has no route to it.

RDS Proxy fits when your code runs in your own AWS account. A Lambda function attached to the VPC can reach the proxy privately, and the database security group can reference the proxy's security group instead of any IP address. If you can move the database calls into that shape, you do not need an IP allowlist at all.

From outside AWS you still carry the problem RDS Proxy exists to fix. Each warm function instance holds its own connection, and a spike opens many at once. Keep each instance's pool at one or two connections and watch `max_connections`. The post on [database connections through SOCKS5](https://fixedmark.com/blog/database-connections-through-socks5-pooling) covers pools, keepalives, and idle timeouts.

## Fixed egress options by platform

The allowlist needs a source address that does not move. Some platforms offer one only on enterprise contracts.

_Ways to give each platform a stable path to RDS_

| Platform           | Native option                                                                   | What to know                                                                                                                                                                                   |
| ------------------ | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Vercel             | Static IPs on Pro and Enterprise; Secure Compute on Enterprise; AWS PrivateLink | Static IPs cost $100 per month per project plus Private Data Transfer, with two IPs per region shared by a small group of customers. Builds use dynamic IPs unless you turn on Use for builds. |
| Netlify            | Private Connectivity                                                            | An add-on to Enterprise plans that needs High-Performance Edge or Build. Functions get static IPs only in the `cmh`, `fra`, and `lhr` regions, and Edge Functions are not covered.             |
| Cloudflare Workers | Hyperdrive, or Cloudflare Tunnel into the VPC                                   | Hyperdrive connects from Cloudflare's published IP ranges, which every other Cloudflare customer shares. Raw `connect()` sockets leave from a prefix outside that published list.              |
| Railway            | Static outbound IPs on Pro                                                      | IPv4 only. Railway does not guarantee the addresses are dedicated, and moving the service to another region changes them.                                                                      |
| Any platform       | A SOCKS5 proxy with fixed exit IPs                                              | Works wherever the driver can open its socket through a proxy. Covered below.                                                                                                                  |

Details come from [Vercel](https://vercel.com/docs/networking/static-ips), [Netlify](https://docs.netlify.com/manage/security/private-connectivity/), [Hyperdrive](https://developers.cloudflare.com/hyperdrive/configuration/firewall-and-networking-configuration/), [Workers sockets](https://developers.cloudflare.com/workers/runtime-apis/tcp-sockets/), and [Railway](https://docs.railway.com/reference/static-outbound-ips). A shared static IP is far narrower than `0.0.0.0/0`, but other customers exit from it too, so keep strong database credentials.

### PrivateLink keeps RDS private, with work on your side

[Vercel's PrivateLink](https://vercel.com/docs/networking/privatelink) connects functions to an AWS endpoint service over the AWS network, and the database never needs a public IP. You have to publish that endpoint service. Vercel supports interface endpoints for services behind a Network Load Balancer, so you put an NLB in front of the database and accept Vercel's IAM role as a principal. The RDS docs note that the instance's underlying IP changes during failover, so plan how the NLB's targets stay current before you rely on it.

### Aurora's Data API skips the network question

If the database is Aurora PostgreSQL or Aurora MySQL, the [RDS Data API](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html) runs SQL over an AWS HTTPS endpoint. Calls are authorized with IAM, database credentials stay in Secrets Manager, and no client needs a route into the VPC. On Vercel, OIDC federation can give functions short-lived AWS credentials for those calls.

The [limits](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.limitations.html) are real. Queries run only on the writer, T instance classes are not supported, and a response over 1 MiB is terminated. It is also not a Postgres driver, so code written against `pg` or an ORM's usual driver needs changes. Plain RDS has no Data API.

## Write the security group rule

Put external clients in their own security group. You see at a glance which addresses come from outside, and you can delete the group if you move to PrivateLink later. [Security group rules](https://docs.aws.amazon.com/vpc/latest/userguide/security-group-rules.html) need a `/32` prefix for a single IPv4 address, and each rule takes an optional description of up to 255 characters for naming its owner.

**Terminal**

```bash
DB=app-db
VPC=$(aws rds describe-db-instances --db-instance-identifier "$DB" \
  --query 'DBInstances[0].DBSubnetGroup.VpcId' --output text)

# A group only for clients outside the VPC
SG=$(aws ec2 create-security-group --group-name app-db-external \
  --description "Fixed egress IPs allowed to reach app-db" \
  --vpc-id "$VPC" --query GroupId --output text)

# One /32 per egress IP, on the database port only
aws ec2 authorize-security-group-ingress --group-id "$SG" --ip-permissions \
  'IpProtocol=tcp,FromPort=5432,ToPort=5432,IpRanges=[{CidrIp=203.0.113.10/32,Description=prod-egress-a},{CidrIp=203.0.113.11/32,Description=prod-egress-b}]'

# The list replaces what is attached, so include the groups already there
aws rds modify-db-instance --db-instance-identifier "$DB" \
  --vpc-security-group-ids sg-0aaaaaaaaaaaaaaaa "$SG" --apply-immediately
```

Then look for open rules on every group attached to the instance. Rules from all attached groups add up, so one open rule on an old group undoes the narrow one.

**Terminal**

```bash
OLD_SG=sg-0aaaaaaaaaaaaaaaa

# Inbound rules open to the whole internet, on IPv4 or IPv6
aws ec2 describe-security-group-rules \
  --filters Name=group-id,Values="$OLD_SG" \
  --query 'SecurityGroupRules[?!IsEgress && (CidrIpv4==`0.0.0.0/0` || CidrIpv6==`::/0`)].[SecurityGroupRuleId,FromPort,ToPort]' \
  --output text

# Remove one by its rule ID once the new path works
aws ec2 revoke-security-group-ingress --group-id "$OLD_SG" \
  --security-group-rule-ids sgr-0bbbbbbbbbbbbbbbb
```

- The [default quotas](https://docs.aws.amazon.com/vpc/latest/userguide/amazon-vpc-limits.html) are 60 inbound rules per security group and 5 groups per network interface. A pair of egress IPs barely touches either.
- Allow every environment that connects. Previews, cron jobs, and build-time migrations often leave from a different address than production. CI runners are covered in [GitHub Actions deploys to allowlisted servers](https://fixedmark.com/blog/github-actions-deploys-to-allowlisted-servers).
- If the instance runs in dual-stack mode, IPv6 needs its own rules. Allow only the address family your egress path actually uses. The post on [IPv6 egress and IPv4-only allowlists](https://fixedmark.com/blog/ipv6-egress-and-ipv4-only-allowlists) covers the mismatch cases.
- Ask for two egress IPs on separate hosts, not one. A single address is a single point of failure, as [static IP pairs and failover](https://fixedmark.com/blog/static-ip-pairs-and-failover) explains.

## Keep TLS on and verify the hostname

A public endpoint makes TLS more important, not less. The [RDS for PostgreSQL SSL page](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Concepts.General.SSL.html) says `rds.force_ssl` defaults to 1 on version 15 and later, and to 0 on 14 and older. On an older instance, set it to 1 in a custom parameter group. A client that then tries without TLS gets `no pg_hba.conf entry for host "w.x.y.z", user "testuser", database "testDB", SSL off`, which is a useful error to recognise.

Forcing TLS is half the job. libpq and JDBC default to `sslmode=prefer`, which encrypts but never checks who answered. Use `verify-full` with the RDS trust store. The [certificate page](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html) publishes a global bundle for all commercial regions, and the default CA is `rds-ca-rsa2048-g1`. Register only the root certificates, not intermediates, or automatic server certificate rotation can break connections. In Asia Pacific (Mumbai), the `rds-ca-rsa4096-g1` and `rds-ca-ecc384-g1` CAs are not available, so instances in `ap-south-1` stay on the RSA 2048 CA.

**Terminal**

```bash
curl -sSo global-bundle.pem \
  https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem

psql "host=app-db.abc123xyz.ap-south-1.rds.amazonaws.com port=5432 \
      dbname=app user=app sslmode=verify-full sslrootcert=global-bundle.pem"
```

The server certificate names the instance endpoint, so `verify-full` passes only when the client checks that exact name. A friendly CNAME in your own domain fails the check. So does a local tunnel on `127.0.0.1`, unless the driver is told the real server name separately.

[IAM database authentication](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html) adds a second layer. The app signs a token that lives 15 minutes and uses it as the password, so a copied connection string stops working quickly. AWS says it needs 300 to 1000 MiB of extra instance memory.

## Route the driver through a fixed IP

Without a platform add-on, the portable route is a SOCKS5 proxy with static exit IPs. SOCKS5 carries raw TCP, so the Postgres protocol and its TLS handshake pass through unchanged. The proxy forwards encrypted bytes and never sees queries or the database password. The catch is that the driver must let you supply its socket.

- [postgres.js](https://github.com/porsager/postgres) takes a `socket` function that can be async and returns a duplex stream. Combine it with the `socks` package.
- Go's pgx takes a custom `DialFunc`. pgx resolves the hostname locally before dialing, so the snippet replaces `LookupFunc` to hand the proxy the RDS name. That keeps DNS on the proxy side, as [socks5 vs socks5h](https://fixedmark.com/blog/socks5-vs-socks5h-dns-resolution) explains, and lets hostname rules on the proxy match.
- node-postgres, psycopg, and other libpq clients have no built-in proxy option. Run a local port forward on a host with a long-lived process, such as a Railway or Render service, and point the driver at it.
- Cloudflare Workers open sockets with `connect()` and cannot use an ordinary proxy client. The post on [edge runtimes and outbound proxies](https://fixedmark.com/blog/edge-runtimes-and-outbound-proxies) covers what works there.

**Node.js (postgres.js)**

```javascript
// npm install postgres socks
import { once } from "node:events";
import { readFileSync } from "node:fs";
import tls from "node:tls";
import postgres from "postgres";
import { SocksClient } from "socks";

// socks5h://user:pass@proxy.example.com:1080
// or socks5s://user:pass@proxy.example.com:1443 for SOCKS5 inside TLS
const proxy = new URL(process.env.SOCKS_PROXY_URL);
const host = process.env.PGHOST; // app-db.abc123xyz.ap-south-1.rds.amazonaws.com

async function openThroughProxy(dbHost, dbPort) {
  let existing;
  if (proxy.protocol === "socks5s:") {
    // Encrypt the hop to the proxy so its credentials are not sent in clear.
    existing = tls.connect({
      host: proxy.hostname,
      port: Number(proxy.port),
      servername: proxy.hostname,
    });
    await once(existing, "secureConnect");
  }
  const { socket } = await SocksClient.createConnection({
    proxy: {
      host: proxy.hostname,
      port: Number(proxy.port),
      type: 5,
      userId: decodeURIComponent(proxy.username),
      password: decodeURIComponent(proxy.password),
    },
    command: "connect",
    // A hostname, not an IP, so the proxy resolves it.
    destination: { host: dbHost, port: Number(dbPort) },
    existing_socket: existing,
    timeout: 10_000,
  });
  return socket;
}

// Create once per function instance, outside the handler.
export const sql = postgres({
  host,
  port: 5432,
  database: "app",
  username: "app",
  password: process.env.PGPASSWORD,
  // Postgres TLS runs inside the tunnel and is checked against the RDS name.
  // Ship global-bundle.pem with the function.
  ssl: { ca: readFileSync("global-bundle.pem"), servername: host },
  socket: ({ host: [h], port: [p] }) => openThroughProxy(h, p),
  max: 1,
  idle_timeout: 60,
});
```

**Go (pgx)**

```go
package db

import (
	"context"
	"net/url"
	"os"

	"github.com/jackc/pgx/v5/pgxpool"
	"golang.org/x/net/proxy"
)

// Connect opens a pool whose connections leave through a SOCKS5 proxy.
func Connect(ctx context.Context) (*pgxpool.Pool, error) {
	u, err := url.Parse(os.Getenv("SOCKS_PROXY_URL"))
	if err != nil {
		return nil, err
	}
	pw, _ := u.User.Password()
	d, err := proxy.SOCKS5("tcp", u.Host,
		&proxy.Auth{User: u.User.Username(), Password: pw}, proxy.Direct)
	if err != nil {
		return nil, err
	}
	dialer := d.(proxy.ContextDialer)

	// postgres://app:PASSWORD@app-db.abc123xyz.ap-south-1.rds.amazonaws.com:5432/app
	//   ?sslmode=verify-full&sslrootcert=global-bundle.pem
	cfg, err := pgxpool.ParseConfig(os.Getenv("DATABASE_URL"))
	if err != nil {
		return nil, err
	}
	// Skip the local DNS lookup, so the proxy receives the RDS name.
	cfg.ConnConfig.LookupFunc = func(_ context.Context, host string) ([]string, error) {
		return []string{host}, nil
	}
	cfg.ConnConfig.DialFunc = dialer.DialContext
	cfg.MaxConns = 2
	return pgxpool.NewWithConfig(ctx, cfg)
}
```

Both snippets keep `verify-full` semantics. postgres.js sends its TLS request through the proxied socket and checks the certificate against `servername`. pgx sets the TLS server name from the host in `DATABASE_URL`, even though the dialer only sees a proxy. Plain SOCKS5 sends the proxy username and password unencrypted, which is why the Node snippet supports TLS to the proxy. The post on [TLS to the proxy](https://fixedmark.com/blog/https-proxy-endpoints-tls-to-the-proxy) covers that hop in more detail.

## Roll it out without dropping traffic

1. 1

   **Add the narrow rules first** Create the external security group with one /32 per egress IP and attach it. Leave any open rule in place for now.
2. 2

   **Ship the connection change everywhere** Deploy the proxy or platform setting to production, previews, scheduled jobs, and build steps. On Vercel, builds only use Static IPs when Use for builds is on.
3. 3

   **Check what the database sees** Run the query below from a fresh connection in each environment. `client_addr` must be one of your egress IPs and `ssl` must be `t`.
4. 4

   **Remove the open rule** Revoke the `0.0.0.0/0` rule by its rule ID. AWS's [connection tracking docs](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-connection-tracking.html) say tracked connections survive a rule change until they time out, but a flow allowed by a `0.0.0.0/0` rule, when the outbound rules are open too, is untracked and drops at once. Expect a missed path to fail quickly.
5. 5

   **Watch a full day** Watch connection errors through a whole daily cycle, so nightly jobs fail while you are looking.

**Check the source address**

```sql
SELECT a.client_addr, a.application_name, s.ssl, s.version
FROM pg_stat_activity a
JOIN pg_stat_ssl s USING (pid)
WHERE a.usename = current_user;
```

## Doing this with Fixedmark

Fixedmark gives an app a pair of static outbound IPs and a SOCKS5 URL, which is the proxy path above. Add both IPs as /32 rules and pass the URL to the driver. Fixedmark is in early access, so the plans and prices below are planned launch values. The [Postgres and MySQL use case](https://fixedmark.com/use-cases/postgres-and-mysql) and the [databases guide](https://fixedmark.com/docs/databases#postgres) have the full setup.

- Pick the region next to the database. Mumbai pairs with RDS in `ap-south-1`, Singapore with `ap-southeast-1`, and Ashburn with `us-east-1`. The [regions page](https://fixedmark.com/regions) lists them.
- Set `SOCKS_PROXY_URL` in the snippets to the `FIXEDMARK_SOCKS_URL` value from the dashboard. Port 1080 is plain SOCKS5, so the token crosses that hop in clear text, while Postgres TLS still protects your data. Port 1443 serves SOCKS5 inside TLS. To use it from the Node snippet, change the URL's scheme to `socks5s://` and its port to 1443, and the snippet takes its TLS branch. The Go snippet speaks plain SOCKS5, so keep it on port 1080. The [concepts page](https://fixedmark.com/docs/concepts#socks5) explains the ports.
- For node-postgres, psycopg, or `psql` on a long-running service, run [fm tunnel](https://fixedmark.com/docs/cli), for example `fm tunnel 5432:app-db.abc123xyz.ap-south-1.rds.amazonaws.com:5432`. Keep the RDS name in `host` and put `127.0.0.1` in `hostaddr` so `verify-full` still checks the right name.
- Production needs a dedicated pair, which starts on Pro at $29 a month. The $9 Starter plan and the trial use a shared pair that other Fixedmark customers also exit from.
- On Business and larger plans, a [destination allowlist](https://fixedmark.com/docs/allowlists) can limit the token to your RDS endpoint on port 5432, so a leaked token reaches nothing else. The [connection logs](https://fixedmark.com/docs/logs) show the egress IP and destination of each connection while you roll out.

If your database code already runs in your own AWS account, keep it there. A Lambda function in the VPC with RDS Proxy and security group references needs no public IP and no proxy.

## Sources

Checked November 2026. Confirm current details on the vendor's site before you decide. Prices and limits change.

- [Amazon RDS: working with a DB instance in a VPC](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.WorkingWithRDSInstanceinaVPC.html)
- [Amazon RDS: RDS Proxy quotas and limitations](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy.html)
- [Amazon RDS: can't connect to a DB instance](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Troubleshooting.html)
- [Amazon RDS: using SSL with a PostgreSQL DB instance](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Concepts.General.SSL.html)
- [Amazon RDS: SSL/TLS certificates and bundles](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html)
- [Amazon RDS: IAM database authentication](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html)
- [Amazon Aurora: using the RDS Data API](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html)
- [Amazon Aurora: Data API limitations](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.limitations.html)
- [Amazon VPC: security group rules](https://docs.aws.amazon.com/vpc/latest/userguide/security-group-rules.html)
- [Amazon VPC: quotas](https://docs.aws.amazon.com/vpc/latest/userguide/amazon-vpc-limits.html)
- [Amazon EC2: security group connection tracking](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-connection-tracking.html)
- [AWS: Amazon VPC pricing (public IPv4)](https://aws.amazon.com/vpc/pricing/)
- [Vercel: Static IPs](https://vercel.com/docs/networking/static-ips)
- [Vercel: AWS PrivateLink](https://vercel.com/docs/networking/privatelink)
- [Netlify: Private Connectivity](https://docs.netlify.com/manage/security/private-connectivity/)
- [Cloudflare Hyperdrive: firewall and networking configuration](https://developers.cloudflare.com/hyperdrive/configuration/firewall-and-networking-configuration/)
- [Cloudflare Workers: TCP sockets](https://developers.cloudflare.com/workers/runtime-apis/tcp-sockets/)
- [Railway: static outbound IPs](https://docs.railway.com/reference/static-outbound-ips)
- [postgres.js: README (custom socket)](https://github.com/porsager/postgres)
- [pgx: pgconn source (LookupFunc and dialing)](https://github.com/jackc/pgx/blob/master/pgconn/pgconn.go)

Keep reading

## Related guides

- [Use case Postgres and MySQL Allowlist two IPs on RDS, Cloud SQL, or a self-hosted database and connect through SOCKS5 or a local tunnel.](https://fixedmark.com/use-cases/postgres-and-mysql)
- [Integration Vercel Fixed egress IPs for Vercel Functions without the $100 per project add-on.](https://fixedmark.com/integrations/vercel)
- [Integration Netlify A fixed source IP for Netlify Functions without an Enterprise contract.](https://fixedmark.com/integrations/netlify)
- [Integration Railway A dedicated IP pair for Railway services when shared static IPs are not enough.](https://fixedmark.com/integrations/railway)
- [Integration Cloudflare Workers Workers cannot set a proxy on fetch. The relay pattern that works instead.](https://fixedmark.com/integrations/cloudflare-workers)
- [Comparison Vercel Static IPs Vercel's native $100 per project Static IPs compared with a Fixedmark proxy URL shared across projects and platforms.](https://fixedmark.com/compare/vercel-static-ips)

## Frequently asked questions

### Can I connect Vercel to RDS without making the instance public?

Yes, with work on the AWS side. Vercel PrivateLink reaches an endpoint service you publish behind a Network Load Balancer, and Secure Compute on Enterprise supports VPC peering. Without one of those, the instance needs public access and a security group rule for your egress IPs.

### Can a serverless function on Vercel or Netlify use RDS Proxy?

No. AWS states that RDS Proxy must be in the same VPC as the database and cannot be publicly accessible. Only clients with a route into that VPC can reach it.

### Is a publicly accessible RDS instance unsafe?

Public access only gives the instance a public IP. The security group still decides who connects. With two /32 rules on the database port, only those addresses can open a TCP connection.

### Why does my connection to RDS time out instead of failing to log in?

Security groups drop packets that match no allow rule, so the client waits until its connect timeout. Check that your real source IP is in an inbound rule on the database port, and that the instance has public access with subnets that route to an internet gateway.

### Does a SOCKS5 proxy see my database queries?

Not when the driver uses TLS to the database. The proxy forwards the encrypted bytes of the Postgres TLS session. Use \`sslmode=verify-full\`, or the driver's equivalent, so the driver also confirms it reached the real RDS endpoint.
