Use AWS Aurora DSQL with DaloyJS
Aurora DSQL is AWS's serverless, distributed PostgreSQL service. It speaks the Postgres wire protocol, so you use the standard pg driver, but auth is short-lived IAM tokens instead of a static password. Pair it with the Lambda adapter for a fully managed AWS-native stack.
1. Provision a cluster
Create a cluster in the AWS console or via the CLI. Note the endpoint hostname and the AWS region.
2. Install
3. Generate a token and connect
DSQL tokens expire (default ~15 minutes), so build a connection helper that refreshes the password before opening a connection. For Lambda, create one client per invocation; for long-lived Node processes, refresh on a timer or on auth errors.
- 01DsqlSignernew DsqlSigner({ hostname, region })
- 02Sign a tokensigner.getDbConnectAdminAuthToken()
- 03Short-lived tokenexpires in ~15 minutes
- 04pg Clientpassword: token · ssl rejectUnauthorized: true
- 05client.connect()Postgres wire protocol over TCP
4. Plugin pattern (long-lived Node)
5. Lambda pattern (per-invocation)
On the Lambda adapter, create the client inside the handler and close it at the end so the IAM token doesn't expire between cold starts:
6. Augment app state
With Drizzle ORM
With Prisma
Use the pg Driver Adapter and inject a Postgres connection that uses the IAM token. The same caveats as above apply: tokens expire, so refresh per Lambda invocation.
Things to remember
- DSQL is TCP-only, so it does not work on Cloudflare Workers or Vercel Edge. Use Neon or PlanetScale there.
- IAM tokens expire, refresh on every Lambda invocation, or wrap re-connection logic around long-lived Node processes.
- DSQL has Postgres-compatible semantics but not 100% feature parity. Check the known issues before relying on niche extensions.
See also the database hosting overview or jump back to Prisma / Drizzle.