Connect PostgreSQL on Amazon RDS via Log Files
Last updated: July 29, 2026
Integration type: RDS Log File Collection (AWS RDS Data API)
Database engine: PostgreSQL
Target type: Instance (standalone RDS)
Applies to: Matters AI DAM
1. Overview
This integration grants Matters AI read-only access to PostgreSQL audit logs on Amazon RDS through the AWS RDS API. Matters discovers log files, downloads log portions, and reads instance metadata and parameter settings — no agent is installed on the database host and no changes are made to the transaction path.
How it works at a high level
You create an IAM role in your AWS account with a trust policy that allows Matters AI to assume it.
You attach an inline policy granting four RDS read permissions to that role.
You register the DB instance in Matters by providing the instance identifier, region, role ARN, and external ID.
Matters assumes the role, pulls PostgreSQL log files on a schedule, and parses them into the DAM pipeline.
What Matters reads: PostgreSQL server logs written by pgaudit and/or log_statement. Matters never issues DML against your database and never has database credentials for this path.
2. Prerequisites
Before starting, confirm the following on the RDS instance and in your AWS account.
2.1 On the RDS instance
PostgreSQL logs must be written to files (not just stderr to CloudWatch) so the RDS API can serve them.
postgresqllog type is included in log exports on the instance (Log exports → PostgreSQL log).Parameter group changes are applied and the instance rebooted where the parameter change type requires it (
pgaudit.logand shared library changes are static → reboot required).
See §2.4 for the exact parameter group configuration.
2.2 Audit path
Matters uses pgaudit as the audit source for PostgreSQL on RDS. pgaudit produces structured, per-object audit records that DAM parses directly. The exact parameter group configuration is in §2.4.
log_statement may be used as a fallback where pgaudit cannot be enabled — contact Matters support before choosing this path, as parser coverage is reduced.
2.3 In AWS
Permission to create IAM roles and inline policies in the AWS account that owns the RDS instance.
Ability to choose an External ID — a random secret string you will use once in the trust policy and once in the Matters UI. Treat it like a shared secret.
2.4 Configure the parameter group
Do not edit the default parameter group — AWS blocks changes to it. If your instance is currently on default.postgres<version>, create a new custom parameter group first.
Go to AWS Console → RDS → Parameter groups.
Create or select a PostgreSQL custom parameter group.
Click Edit parameters.
Update the following:
Parameter
Value
shared_preload_librariesinclude
pgauditpgaudit.logread,ddl,role,misc,writepgaudit.log_levellogpgaudit.log_parameter1pgaudit.log_statement1Save the changes.
After applying the parameter group (see §2.5), connect to the DB and run:
CREATE EXTENSION IF NOT EXISTS pgaudit;
2.5 Attach the audit-enabled parameter group to the instance
Go to AWS Console → RDS → Databases, select your instance.
Click Modify.
Scroll to DB parameter group.
Select your custom audit-enabled parameter group.
Click Continue.
Choose one:
Apply immediately — non-production.
Apply during maintenance window — production.
Click Modify DB instance.
Note: PostgreSQL requires a reboot for shared_preload_libraries changes to take effect.
2.6 Verify the configuration
After the reboot, connect to the instance and confirm:
SHOW shared_preload_libraries; -- should include pgaudit
SHOW pgaudit.log; -- read,ddl,role,misc,write
SELECT * FROM pg_extension WHERE extname = 'pgaudit'; -- one row per audited DB
Also confirm that PostgreSQL log is enabled under the instance's Log exports setting.
2.7 In Matters
Access to the Matters console with permission to add an integration.
The DB instance identifier (the AWS-assigned name, e.g.
prod-pg-01) and the AWS region (e.g.us-east-1).
3. Configure the integration in Matters
In the Matters console, open Integrations → Connect RDS via Log Files and complete the following.
3.1 Integration configuration
Field | Value |
|---|---|
Integration Name | A friendly name for this instance, e.g. |
Integration Mode | Create New (choose Use Existing only when reusing a prior role). |
Database Type | PostgreSQL |
Target Type | Instance |
Click Next. The wizard now walks through three steps in AWS.
4. Step 1 — Create the IAM role with a custom trust policy
This role is what Matters AI assumes to read your logs. The trust policy pins the Matters AI AWS principal and requires the External ID you choose.
4.1 Choose an External ID
Pick a unique, non-guessable string (for example a UUID or a 32-character random string). You will use this value twice:
Once inside the trust policy below (replace
<EXTERNAL_ID>).Once at the end of the wizard when Matters asks for it.
If you skip the External ID, Matters falls back to account ID 471112501839 for authentication, which is weaker. We strongly recommend setting one.
4.2 Trust policy
Replace <EXTERNAL_ID> with the value you chose.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::471112501839:root"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"sts:ExternalId": "<EXTERNAL_ID>"
}
}
}
]
}
4.3 Create the role in AWS
Sign in to the AWS Management Console and open IAM.
In the left sidebar, click Roles, then Create role.
Under Trusted entity type, select Custom trust policy.
Paste the JSON above into the editor with your
<EXTERNAL_ID>filled in.Click Next — you will add permissions in the next step, so skip the permission selection here.
Enter a Role name (suggested:
MattersRDSLogFilesReader) and click Create role.
Return to Matters and click I've created the Role with Trust Policy.
5. Step 2 — Attach the inline permissions policy
The policy grants four read-only permissions used to discover log files, download log content, read instance metadata, and read parameter settings.
5.1 Permissions policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "MattersRdsLogCollection",
"Effect": "Allow",
"Action": [
"rds:DescribeDBInstances",
"rds:DescribeDBLogFiles",
"rds:DownloadDBLogFilePortion",
"rds:DescribeDBParameters"
],
"Resource": "*"
}
]
}
What each action is used for
Action | Purpose |
|---|---|
| Read instance metadata (engine, version, endpoint, parameter group). |
| List log files available on the instance. |
| Read the content of each log file in chunks. |
| Read the parameter group to confirm |
Tightening the resource scope (optional but recommended for production): replace "Resource": "*" with the ARN of the specific instance, e.g. "arn:aws:rds:us-east-1:<account-id>:db:prod-pg-01".
5.2 Attach in AWS
Open the role you just created and go to the Permissions tab.
Click Add permissions → Create inline policy.
Select the JSON tab and paste the policy above.
Click Review policy, name it (suggested:
MattersRDSPostgreSQLLogPolicy), and click Create policy.
Return to Matters and click I've attached the IAM policy.
6. Step 3 — Enter connection details
Provide the identifiers Matters needs to call the RDS API.
Field | Value |
|---|---|
DB Instance Identifier | The AWS-assigned instance name — e.g. |
AWS Region | The region where the instance is deployed — e.g. |
IAM Role ARN | The ARN of the role you created, e.g. |
External ID | The exact value you placed inside the trust policy in Step 1. |
Click Connect.
Matters will:
Assume the role using STS with the External ID.
Call
DescribeDBInstancesandDescribeDBParametersto validate configuration.Call
DescribeDBLogFilesandDownloadDBLogFilePortionto begin log ingestion.
If validation succeeds, the integration moves to the Connected state and log ingestion begins.
7. Post-connection: what Matters does
Once connected, Matters continuously pulls new PostgreSQL log content, parses pgaudit / log_statement entries, and applies DAM policies. Downstream capabilities that become active:
Query and object-level activity capture (SELECT / DML / DDL / privileged commands based on what you have logged).
Policy-driven alerting (privileged user creation, sensitive object access, off-hours activity, etc.).
Feed into UEBA and DDR pipelines.
Audit evidence for RBI, DPDP, PCI-DSS, and ISO 27001 reporting.
8. Verification checklist
Use this checklist after clicking Connect.
Integration shows Connected in Matters within a few minutes.
DescribeDBParametersreflectspgaudit.logand/orlog_statementset to your intended value.At least one log file appears in the ingestion view within one poll cycle.
A test query on the database (e.g. a
CREATE USERor aSELECTagainst a sensitive table) appears in the DAM activity view within the expected latency window.No
AccessDeniederrors are visible in the integration status panel.
9. Troubleshooting
Symptom | Likely cause | Fix |
|---|---|---|
| External ID mismatch, or trust policy not saved. | Re-open the role's trust policy in IAM and confirm the |
| Inline policy not attached, or wrong role selected. | Confirm the inline policy is attached to the same role whose ARN you entered in Matters. |
Integration connects but no activity appears |
| Confirm §2.4 settings, run |
Instance not found | Wrong DB Instance Identifier or wrong region. | Use the AWS-assigned identifier (not the endpoint hostname) and the exact region code. |
Logs appear but queries do not | Only error-level logging is enabled. | Set |
10. Security notes
The role granted here is read-only and scoped to four RDS API actions. It cannot modify the database, the instance, or any other AWS resource.
Matters authenticates using STS AssumeRole with External ID — no long-lived AWS access keys are exchanged or stored.
You can revoke access at any time by detaching the inline policy or deleting the role.
For tighter posture, scope
Resourcein the inline policy to the specific DB instance ARN instead of .
11. Reference values
Item | Value |
|---|---|
Matters AWS principal |
|
Fallback account (no External ID) |
|
Suggested role name |
|
Suggested inline policy name |
|
Required RDS API actions |
|