Managing an RDS Postgres password using Secrets Manager rotation and wire-level filters

Published
Length
3 min read

Luis Felipe Dias

All posts

You manage an RDS Postgres password by using AWS Secrets Manager to rotate database credentials while a proxy checks every query on the wire. This combination keeps secrets fresh and blocks dangerous statements before they touch production data. Relying only on secret rotation creates a false sense of security. When a worker process or an AI agent gets access, it can read customer data or drop a table in seconds. Rotating a password next week does not stop an active connection from causing a ma

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 manage an RDS Postgres password by using AWS Secrets Manager to rotate database credentials while a proxy checks every query on the wire. This combination keeps secrets fresh and blocks dangerous statements before they touch production data.

Relying only on secret rotation creates a false sense of security. When a worker process or an AI agent gets access, it can read customer data or drop a table in seconds. Rotating a password next week does not stop an active connection from causing a major outage today.

How AWS Secrets Manager handles an RDS Postgres password

Managing database secrets in AWS usually starts with automated storage. Amazon RDS connects directly with AWS Secrets Manager to manage master user accounts. Secrets Manager creates a strong password, saves it in a vault, and rotates it every seven days by default. You can set shorter schedules with rate or cron rules, down to four hours.

For regular application users, Secrets Manager uses an AWS Lambda function to change passwords. AWS supports single-user and alternating-user setups. In a single-user setup, the function updates the password in PostgreSQL and changes the stored secret. Open database sessions remain alive during this change.

Teams can also use AWS IAM database authentication to avoid static passwords. IAM creates short-lived tokens that last fifteen minutes. The application uses this token as the password during login. Once the client logs in, PostgreSQL treats it like a normal session.

What rotation solves and what it leaves open

Rotating an RDS Postgres password solves the problem of old passwords living forever in flat files. If someone copies a credential, that secret expires on the next rotation window. Security groups also help by blocking public network access to the port.

Yet credentials only decide who can log in. They do not watch what an authenticated client does. Today, teams give background workers and AI tools a database login with broad read rights. If a tool runs a query that returns payment data, customer emails, or private tokens, PostgreSQL returns the full result set. The database cannot tell an accidental query from a valid business request.

AWS Secrets Manager + Secret Rotation Automation: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Standard database permissions also fail to block bad intent. A read-only role stops table drops on objects it does not own. But automated tools often run with write permissions during updates or migrations. If an agent runs an update without a filter, it can destroy millions of records at once.

Filtering traffic at the wire level with hoop.dev

Teams use hoop.dev to solve the gaps that credential managers cannot reach. hoop.dev provides an open-source proxy deployed right beside your database that inspects each statement and validates query results. It runs next to your Postgres instance. Your client tools simply point their host and port to the proxy. Your database users, table grants, and AWS rotation schedules stay in place.

Because hoop.dev speaks PostgreSQL natively, it reads every message in the wire protocol. It brings three key controls to the connection:

  • Guardrails: hoop.dev checks statements before they hit the database engine. If an agent tries to drop a table or run an update with no filter, the proxy refuses the query. The client receives the database's own error with the message the operator wrote.
  • Data masking: When a query returns records with personal details or tokens, hoop.dev data masking rewrites those values in memory. Tables on disk keep their true data.
  • Audit trails and reviews: hoop.dev keeps a clear log of every statement and decision for each protected resource. If a statement looks dangerous, hoop.dev can pause the execution until an engineer reviews it.

By pairing AWS Secrets Manager with hoop.dev, teams solve both sides of database access. Secrets Manager handles password changes over time. Meanwhile, hoop.dev decides what runs and what comes back.

Practical steps for engineering teams

A safe database setup requires two layers. First, turn on automated rotation in AWS Secrets Manager so no password stays active forever. Second, place hoop.dev guardrails on the wire to check incoming SQL.

To see how the proxy parses statements and to inspect the code, visit the hoop.dev GitHub repository.

Frequently asked questions

Does AWS Secrets Manager drop open database connections during rotation?

In a single-user rotation setup, AWS Secrets Manager does not drop open connections. Existing sessions stay active until they close, while new handshakes must use the updated password.

Can IAM database authentication replace PostgreSQL roles?

No. PostgreSQL roles still control which schemas and tables that user can access once connected.

How does hoop.dev filter queries without changing application code?

hoop.dev speaks the PostgreSQL wire protocol. You only point the database host and port in your connection string to the proxy, letting it evaluate queries and mask results on the wire.

The query runs. The emails stay hidden.