How to Configure Neon IAM Authentication

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up neon iam authentication by linking your identity provider or cloud account to your database. Your team then uses short-lived tokens or web logins instead of static database passwords. Most teams start by mapping broad engineering groups to shared database roles. When those shared roles have wide permissions, any user can run risky queries on production tables. How neon iam authentication works in practice Neon splits control plane management from direct SQL sessions on your Postgre

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up neon iam authentication by linking your identity provider or cloud account to your database. Your team then uses short-lived tokens or web logins instead of static database passwords. Most teams start by mapping broad engineering groups to shared database roles. When those shared roles have wide permissions, any user can run risky queries on production tables.

How neon iam authentication works in practice

Neon splits control plane management from direct SQL sessions on your Postgres branches. For the control plane, teams link a central identity provider so engineers log in with single sign-on. Admins can also issue scoped API keys for automated workflows and scripts. This setup governs who can create branches, manage compute sizes, or delete projects.

Direct SQL sessions on a database branch work in a different way. Standard Postgres roles inside the database engine still verify the user at login time. When teams pair cloud identity with Neon, an app requests a token from the identity provider. The app then passes that token or mapped role credential to the Postgres endpoint.

Teams also use the built-in auth extension to sync user profiles into a dedicated database schema. Row-level security policies then read the active user ID during a transaction. This lets the database filter table rows based on who sent the query. Each step relies on clean mapping between external identity claims and internal Postgres roles.

How to map external identities to Postgres roles

Start by listing every human team and automated service that needs database permissions. Create distinct Postgres roles for read-only work, schema changes, and app traffic. Avoid giving the default project owner role to human engineers or app workloads. Keep the owner role locked down for emergency recovery only.

Next, configure your identity provider or cloud role trust policies to match those database groups. Assign each engineer to a group that matches their daily job duties. When an engineer leaves the team, remove them from the central identity provider right away. Revoking their central account stops them from opening the console or getting new tokens.

Test your role mappings on a non-production database branch before you update production. Neon branches copy the schema and role definitions from the parent branch in seconds. Run test queries with a restricted role to check that permission boundaries hold firm. Fix any missing table grants before you apply the changes to your main branch.

Service-to-Service Authentication + AWS IAM Policies: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native identity setup solves and what it misses

Central identity mapping removes the need to share static passwords in chat apps or files. It gives security teams one place to turn off logins when someone changes jobs. You also get clear logs showing which user account opened the management console.

Still, login checks only decide who can open a session with the database. Once a Postgres session starts, the database trusts every command allowed by that role. If an engineer logs in with a write role, they can still drop rows by mistake. Native login checks do not pause a bad update statement while it runs.

Shared roles also make it hard to see which person ran a specific SQL query. If five engineers share one read role, the database log only shows that role name. Also, a standard select role returns raw emails, phone numbers, and card numbers in query results. Dynamic data masking is needed to rewrite those matched fields in results before they reach the screen.

Check every Postgres query on the wire

Database roles and network rules decide who can open a session. They do not read what each SQL statement does after login. With hoop.dev, you run an open-source proxy, a sidecar for your Postgres, inline in the Postgres wire protocol. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review. Your apps and agents keep their login details and change only the host and port in the connection string their tool uses.

Before a query runs, hoop.dev guardrails refuse bad deletes or drops with a real Postgres error, or hold risky queries for approval. On the way back, hoop.dev data masking rewrites sensitive values in returned rows in memory, and every verdict goes to the audit trail. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and generates evidence for HIPAA, GDPR, and PCI DSS. See the code on GitHub.

Frequently asked questions

Does Neon support native AWS IAM database tokens like RDS?

No, Neon does not use the native RDS token signer for direct Postgres logins. Teams instead use identity providers, short-lived API tokens, or external auth workflows to manage database access.

How do I remove an engineer's access across all database branches?

Remove the user from your central identity provider and revoke their personal API keys. If they used a shared Postgres password, you must also rotate that password on every branch.

Can row-level security replace statement inspection for human engineers?

Row-level security filters which rows a role can read or change inside a table. Still, most engineers use broad roles that bypass row policies, so statement checks remain vital.

The query runs. The emails stay hidden.