> For the complete documentation index, see [llms.txt](https://docs.blusapphire.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.blusapphire.io/log-forwarding/03_log-forwarding-guide/cloud-log-forwarding/postgresql-rds-integration.md).

# PostgreSQL RDS Integration

Integration Guide

**PostgreSQL RDS** with **BluSapphire**

## **STEP 1 Identify the RDS PostgreSQL Log Group**

1. Log in to the **AWS Management Console**.
2. Navigate to **RDS → Databases**.
3. Select the PostgreSQL database instance.
4. Open the database configuration and confirm that **PostgreSQL log export to CloudWatch** is enabled.
5. Navigate to **CloudWatch → Logs → Log groups**.
6. Locate the PostgreSQL log group. For a standard RDS PostgreSQL instance, the name is generally: /aws/rds/instance/\<DB\_INSTANCE\_IDENTIFIER>/postgresql
7. Open the log group and select a log stream.
8. Confirm that log events are being generated and that their timestamps are current.

**REFERENCE** <https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER%5FLogAccess.Concepts.PostgreSQL.html>

## **STEP 2 Create a Dedicated IAM Policy**

1. Navigate to **IAM → Policies → Create policy**.
2. Select the **JSON** policy editor.
3. Add the following policy, replacing the placeholders with the actual client values.

{

"Version": "2012-10-17",

"Statement": \[

{

"Sid": "DescribeCloudWatchLogGroups",

"Effect": "Allow",

"Action": \[

"logs:DescribeLogGroups"

],

"Resource": "\*"

},

{

"Sid": "ReadPostgreSQLLogEvents",

"Effect": "Allow",

"Action": \[

"logs:FilterLogEvents"

],

"Resource": "arn:aws:logs::\<ACCOUNT\_ID>:log-group\:/aws/rds/instance/\<DB\_INSTANCE\_IDENTIFIER>/postgresql:\*"

}

]

}

**CAUTION** Replace the placeholders in the policy using the values below.

| **Placeholder**             | **Replace With**                  | **Example**      |
| --------------------------- | --------------------------------- | ---------------- |
|                             | The AWS Region                    | ap-south-1       |
| \<ACCOUNT\_ID>              | The 12-digit AWS account ID       | 123456789012     |
| \<DB\_INSTANCE\_IDENTIFIER> | The exact RDS instance identifier | prod-postgres-01 |

1. Name the policy PostgreSQLCloudWatchReadOnly.
2. Review and create the policy.

**NOTE** The policy allows the integration to discover CloudWatch log groups and retrieve events from the specified PostgreSQL log group. It does not grant permission to modify the RDS database or its logging configuration.

## **STEP 3 Create an IAM User and Access Keys**

1. Navigate to **IAM → Users → Create user**.
2. Create a user named rds-log-collector.
3. Do **not** enable AWS Management Console access.
4. Attach the PostgreSQLCloudWatchReadOnly policy.
5. Open the user's **Security credentials** tab.
6. Select **Create access key** and choose the appropriate use case for an external application.
7. Save the **Access Key ID** and **Secret Access Key** securely.

## **STEP 4 Details to Share with the Integration Team**

1. AWS Account ID
2. AWS Region
3. EKS Cluster Name
4. CloudWatch Log Group Name
5. Audit Log Stream Prefix
6. IAM Access Key ID
7. IAM Secret Access Key
8. CloudWatch Log Group Retention Period
