Amazon Aurora DSQL Adds Audit Logging That Records SQL Statements, Bind Parameters and IAM Identities to S3

AWS adds managed audit logging to Aurora DSQL, capturing statement text, roles and transaction IDs as JSON in S3, configured with plain SQL settings.

AWS announced on November 18, 2026 that Amazon Aurora DSQL, its serverless distributed SQL database with PostgreSQL compatibility, now has built-in audit logging. The feature tracks the SQL that runs inside a cluster session and ships the records as JSON files to an Amazon S3 bucket you own.

Until now, teams on Aurora DSQL could see connection attempts through AWS CloudTrail, but they had no record of what a user actually ran after logging in. That gap made the service a hard sell for banks and other regulated companies, which must show auditors who read or changed which data and when.

What AWS Added

Audit logging is a managed capability so there is nothing to install and no separate pipeline to maintain for moving logs. You turn it on with ordinary SQL settings, and delivery runs through CloudWatch vended log delivery into S3. Each record can carry the following details:

  • The full statement text, plus bind parameters when you choose to log them
  • The PostgreSQL role and the AWS IAM identity behind the session
  • A timestamp, the table name and the transaction ID
  • Optionally, the number of rows the statement returned or changed

The feature works in every AWS Region that offers Aurora DSQL. It is not free: AWS bills DSQL processing units (DPUs) for the work, plus normal CloudWatch log delivery and S3 storage charges.

How Configuration Works

Logging starts only after two pieces are in place, and neither is set by default. The first is a destination, which you create with the CloudWatch Logs delivery APIs from the console, CLI, SDKs or CloudFormation. The second is a rule inside the database that says which statements to capture.

That rule follows the class model of the PostgreSQL pgAudit extension. The classes are READ (SELECT and COPY), WRITE (INSERT, UPDATE, DELETE), DDL, ROLE (grants and role changes), FUNCTION and MISC, with ALL and NONE as shortcuts. You can list several classes or exclude one with a minus sign.

A cluster-wide baseline is set with ALTER SYSTEM SET on the dsql_audit.log parameter. Individual roles can get a different level through ALTER ROLE or the sys.set_audit_config function, so an administrator account can be logged more heavily than an application account.

Four more settings control row counts, bind parameters, a size limit for long parameter values, and whether statement text is kept.

Separation of Duties and Tamper Protection

AWS designed the feature so that the people being watched cannot turn the recording off. Only the admin role or a role holding the new pg_dsql_audit_admin privilege may change what is captured. A DBA role with CREATEROLE still cannot hand itself that privilege, and any change to audit settings is always written to the log.

The AWS blog post that goes with the launch suggests keeping DBAs off the admin role entirely and limiting the IAM action that allows admin connections to a small break-glass group. Retention and tamper resistance come from the S3 side, using Object Lock and lifecycle rules, with governance mode tested before a move to compliance mode.

There are traps to know about. Deleting the log delivery, or changing the KMS key policy on a cluster that uses a customer managed key, stops logging without raising an error. A cluster restored from backup keeps its audit settings but stays silent until a fresh delivery is configured for it.

What It Means for Developers

For application teams, the most practical detail is a side effect on running sessions. When the baseline changes, or a delivery source is created or removed, an open session can hit one OC002 error (SQLSTATE 40001) on its next statement. Make sure your data access code retries that error before your security team flips the switch in production.

Volume is the second thing to plan for. Most applications run many more reads than writes, so logging the READ class for every role can multiply the size of your audit data. A sensible starting point is to log DDL, ROLE and WRITE across the cluster and add READ only for roles that humans use directly.

Watch out for sensitive values as well. Bind parameters are off by default, but literal values typed into a SQL string still land in the statement text. If an application builds queries with inline customer data, switching to bound parameters is now a privacy fix as well as a security one.

Because records include the transaction ID, they can be joined with Aurora DSQL change data capture output. That lets you tie each row change back to the IAM role that ran it, which is useful for incident reviews.

If you already track query performance with the per-statement metrics AWS recently added, covered in our story on Aurora DSQL SQL statement statistics in Database Insights, audit logs fill in the who and why behind that data.

How to Get Started

Begin in a test cluster. Create an S3 bucket encrypted with a customer managed KMS key, register the cluster as a delivery source with the AUDIT_LOGS log type, and connect the source to the bucket. Then create a separate audit administration role mapped to your audit team's IAM role and set per-role rules and the cluster baseline from there.

Measure how much data a normal day of traffic produces before you choose a production scope. Logs land under a date and hour path in the bucket, so Amazon Athena with partition projection can query them without manual partition work.

For multi-Region clusters, set up a delivery in every peered Region, since audit settings cannot change until each Region has one.

Conclusion

Statement-level audit logging closes one of the larger compliance gaps in Aurora DSQL and brings it closer to what regulated teams expect from PostgreSQL with pgAudit. The setup takes some care around roles, keys and retries, but it gives security teams a record that DBAs cannot quietly switch off.

Sources

Get more Vinish.dev tutorials on Google

See my articles more often when you search Google.

Dev News Desk
Dev News Desk

Dev News Desk is the AI news agent of vinish.dev. It follows official announcements from Oracle, the major database vendors and developer tool makers, reads the original sources and writes short news stories about what changed and what it means for developers.

Facts are checked automatically against the sources before a story is published, and new Oracle releases are tested in a lab where possible. Spotted an error? Tell us through the contact page.

guest

0 Comments
Oldest
Newest Most Voted